I wrote/tweaked a Tiff cmake build system, this is what I use:

IF (BUILD_SHARED_LIBS)
    IF (WIN32 AND NOT MINGW)
        SET(LIB_RELEASE_NAME "tiffdll")
        SET(LIB_DEBUG_NAME "tiffdll_D")
    ELSE (WIN32 AND NOT MINGW)
        SET(LIB_RELEASE_NAME "tiff")
        SET(LIB_DEBUG_NAME "tiff_debug")
    ENDIF(WIN32 AND NOT MINGW)
ELSE (BUILD_SHARED_LIBS)
    IF (WIN32 AND NOT MINGW)
        SET(LIB_RELEASE_NAME "libtiff")
        SET(LIB_DEBUG_NAME "libtiff_D")
    ELSE (WIN32 AND NOT MINGW)
        SET(LIB_RELEASE_NAME "tiff")
        SET(LIB_DEBUG_NAME "tiff_debug")
    ENDIF(WIN32 AND NOT MINGW)
ENDIF (BUILD_SHARED_LIBS)

ADD_LIBRARY(tiff ${LIB_TYPE} ${TIFF_SRCS} ${TIFF_HEADERS})
TARGET_LINK_LIBRARIES( tiff ${SUPPORT_LIBS} )

SET_TARGET_PROPERTIES( tiff
    PROPERTIES
    DEBUG_OUTPUT_NAME ${LIB_DEBUG_NAME}
    RELEASE_OUTPUT_NAME ${LIB_RELEASE_NAME}
)

#----- Use MSVC Naming conventions for Shared Libraries
IF (MINGW AND BUILD_SHARED_LIBS)
    SET_TARGET_PROPERTIES( tiff
        PROPERTIES
        IMPORT_SUFFIX ".lib"
        IMPORT_PREFIX ""
        PREFIX ""
    )
ENDIF (MINGW AND BUILD_SHARED_LIBS)


_________________________________________________________
Mike Jackson                  [email protected]
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Mar 4, 2009, at 10:06 AM, Dmytro Ovdiienko wrote:

Hello All,

I use CMake to build my project's sources on windows and linux using static and dynamic runtimes.

I would like to add information about build configuration to the output file name as suffix.

For instance:
- libsome_lib_linux_x32.a - static library "some_lib" for linux 32bit - some_lib_windows_x64_md.lib - static library "some_lib" for windows 64bit with dynamic release runtime - some_lib_windows_x62_mtd.lib - static library "some_lib" for windows 32bit with static debug runtime

For windows I generate projects with debug and release configurations.

Right now I play with
  - CMAKE_STATIC_LIBRARY_SUFFIX
  - CMAKE_SHARED_MODULE_SUFFIX
  - CMAKE_SHARED_LIBRARY_SUFFIX
  - CMAKE_EXECUTABLE_SUFFIX
  - CMAKE_<CONFIG>_POSTFIX

But it is not enought. CMAKE_<CONFIG>_POSTFIX changes suffix only for dll and lib files. But not for exe file.

Also I played with <CONFIG>_OUTPUT_NAME. It solves my problem but I have to change this property for all my projects. It is not obvious in my case. I have too much projects.

Question: How can I setup suffixes for every configuration in one place?

Regards,
Dima
_______________________________________________
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

_______________________________________________
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

Reply via email to