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

Dmytro Ovdiienko dmitriy.ovdienko at gmail.com
Wed Mar 4 11:53:39 EST 2009


Have to remember why I added suffixes :). Looks like you are right.

2009/3/4 Michael Jackson <mike.jackson at bluequartz.net>

> Actually, if you are on Visual Studio or Xcode then those IDEs will create
> sub-directories for Debug and Release, so in effect, those builds are
> separated. If you are using Makefiles then, yes, create 2 separate build
> directories and run cmake in each one of those setting the CMAKE_BUILD_TYPE
> to either Debug or Release then build.
>
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
>            www.bluequartz.net
>
>
> On Mar 4, 2009, at 11:45 AM, Dmytro Ovdiienko wrote:
>
>  Michael,
>>
>> Ya. For now it is the best solution.
>>
>> Another solution is to generate project files for debug and release
>> separately.
>>
>> Regards,
>> Dima
>>
>> 2009/3/4 Michael Jackson <mike.jackson at bluequartz.net>
>> I started another thread to ask for some clarification on those issues.
>>
>> If I were you I would write a macro that combines everything that I sent
>> into a single macro call. That way in each of your projects you could do
>> something like:
>>
>> add_my_executable(exename sources other_stuff debug_postfix)
>>
>> and then you can get all the benefits of having a _debug post fix on your
>> libraries and executables.
>>
>>
>>
>> _________________________________________________________
>> Mike Jackson                  mike.jackson at bluequartz.net
>> BlueQuartz Software                    www.bluequartz.net
>> Principal Software Engineer                  Dayton, Ohio
>>
>>
>>
>> On Mar 4, 2009, at 11:21 AM, Dmytro Ovdiienko wrote:
>>
>> Michael,
>>
>> Thank you for your replay.
>>
>> <CONFIG>_POSTFIX is a target property. User still have to update all
>> projects in the source tree.
>>
>> BTW why CMAKE_<CONFIG>_POSTFIX applies only for non-executable?
>>
>> Regards,
>> Dima
>>
>> 2009/3/4 Michael Jackson <mike.jackson at bluequartz.net>
>>      • <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
>>
>>
>>
>>
>>
>>
>>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090304/e0b37751/attachment.htm>


More information about the CMake mailing list