On 10/16/2011 06:27 PM, zex spectrum wrote: > Hello, > > 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 <Config>_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.
AFAIK, a shared library target's import library is named like ... + ARCHIVE_OUTPUT_NAME_<CONFIG> + <CONFIG>_POSTFIX + IMPORT_SUFFIX so you cannot use the IMPORT_SUFFIX to overwrite the <CONFIG>_POSTFIX. > I use MSVC, I do not need to have this for GCC and other compilers. > > Any help would be appreciated. You might use an additional INSTALL(CODE ...) step, see the attached CMakeLists.txt file. Note that the LOCATION property might have side effects, cf. [1], so it's probably best to place it at the very end. 'hope that helps. Regards, Michael [1] http://public.kitware.com/Bug/view.php?id=11671
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(IMPLIB C) SET(CMAKE_VERBOSE_MAKEFILE ON) FILE(WRITE ${CMAKE_BINARY_DIR}/f.c "__declspec(dllexport) void f(void){}\n") ADD_LIBRARY(f SHARED f.c) SET_TARGET_PROPERTIES(f PROPERTIES DEBUG_POSTFIX "80") INSTALL(TARGETS f RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) GET_TARGET_PROPERTY(F0 f LOCATION_DEBUG) GET_FILENAME_COMPONENT(F0 "${F0}" NAME_WE) STRING(REGEX REPLACE "80\$" "" F "${F0}") INSTALL(CODE "FILE(RENAME \"${CMAKE_INSTALL_PREFIX}/lib/${F0}.lib\" \"${CMAKE_INSTALL_PREFIX}/lib/${F}.lib\")")
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake