[CMake] exe/a/so sufixes depend on configuration

Michael Jackson mike.jackson at bluequartz.net
Wed Mar 4 10:46:29 EST 2009


	• <CONFIG>_POSTFIX: Postfix to append to the target file name for  
configuration <CONFIG>.
When building with configuration <CONFIG> the value of this property  
is appended to the target file name built on disk. For non-executable  
targets, this property is initialized by the value of the variable  
CMAKE_<CONFIG>_POSTFIX if it is set when a target is created. This  
property is ignored on the Mac for Frameworks and App Bundles.

	• CMAKE_<CONFIG>_POSTFIX: Default filename postfix for libraries  
under configuration <CONFIG>.
When a non-executable target is created its <CONFIG>_POSTFIX target  
property is initialized with the value of this variable if it is set.




_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



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

> Michael,
>
> RELEASE_OUTPUT_NAME/DEBUG_OUTPUT_NAME properties are the only way to  
> do this. But I have to set these properties for every project (I  
> have 36 projects). Noo.. I'm too lazy to do this :)
>
> I beleive there is a property like CMAKE_<CONFIG>_POSTFIX to change  
> suffix for executable.
>
> 2009/3/4 Michael Jackson <mike.jackson at bluequartz.net>
> 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                  mike.jackson at bluequartz.net
> 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
>
>



More information about the CMake mailing list