I generate a shared library named, for example, mylib80.dll (it has
postfix “80”, because I want to embed version info into library name.
I use set_target_properties with _POSTFIX property to achieve
this. By default, CMake names corresponding import library as
mylib80.lib. But I want my shared lib to have an import lib named
mylib.lib (without version embedded into its name).
Is it possible at
all? I tried IMPORT_SUFFIX, but it seems to not work as I expect.
I use MSVC, I do not need to have this for GCC and other compilers.
Any help would be appreciated.
Use the following CMake target properties to specify separate names for *.lib and *.dll files, rather than using the _POSTFIX property:
http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:ARCHIVE_OUTPUT_NAME
http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LIBRARY_OUTPUT_NAME
http://cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:RUNTIME_OUTPUT_NAME
The RUNTIME_OUTPUT_NAME property corresponds to the name of the dll file, and one of the others (I always forget which one…) corresponds to the name of the lib file.
If the lib is already named correctly without _POSTFIX, then simply rename just the dll file using the RUNTIME_OUTPUT_NAME property.