[Cmake] MSDev multiple build types

William A. Hoffman billlist at nycap.rr.com
Mon Aug 23 09:16:38 EDT 2004


You can use the debug or optimized option in these commands:

LINK_LIBRARIES(library1 <debug | optimized> library2 ...)

TARGET_LINK_LIBRARIES: Link a target to given libraries.

TARGET_LINK_LIBRARIES(target library1
                        <debug | optimized> library2
                        ...)

Specify a list of libraries to be linked into the specified target. The debug and optimized strings may be used to indicate that the next library listed is to be used only for that specific type of build .
http://www.cmake.org/HTML/Documentation.html

-Bill


At 08:51 AM 8/23/2004, Dekeyser, Kris wrote:
>Our project uses some 3rd party libraries that have different paths and
>names depending on the build type. (e.g. Xerces-C)
>
>MSDev has multi-config project files but CMake unfortunately can not know in
>advance which build type will be choosen. This makes it difficult (if not
>impossible) to write a TARGET_LINK_LIBRARIES statement for that library.
>
>I therefore wanted to force the MSDev user to choose in advance which build
>type will be used. I wrote the following code in my root CMakeLists.txt:
>
>OPTION(DEBUG_BUILD "Build for debug?" TRUE)
>IF(DEBUG_BUILD)
>  SET(DebugBuild TRUE)
>  SET(CMAKE_BUILD_TYPE Debug)
>ELSE(DEBUG_BUILD)
>  SET(DebugBuild FALSE)
>  SET(CMAKE_BUILD_TYPE Release)
>ENDIF(DEBUG_BUILD)
>
>That's working fine, but still the developer can select another build type
>in the MSDev environment and that will point the library to the wrong
>libraries. So I added the following:
>
># MsDev's multiple configurations screw up things with libraries that have
>different name and/or paths depending on the build configuration
>SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
>
>Hoping this would disable the generation of the not-relevant build types. To
>my disappointment that did not change anything.
>
>"Mastering CMake" chapter 3.5 says: "[...] The variable
>CMAKE_CONFIGURATION_TYPES is used to tell CMake which configurations to put
>in the workspace.[...]". Am I misinterpreting this or is this a bug in
>CMake?
>
>Best regards, Kris.
>+-+-+- Email Confidentiality Footer +-+-+- 
>Privileged/Confidential Information may be contained in this message. If you
>are not the addressee indicated in this message (or responsible for delivery
>of the message to such person), you may not print, retain, copy nor
>disseminate this message or any part of it to anyone and you should notify
>the sender by reply email and destroy this message. Neglecting this clause
>could be a breach of confidence. Please advise immediately if you or your
>employer does not consent to Internet email for messages of this kind.
>Opinions, conclusions and other information in this message that are not
>related to the official business of my firm shall be understood as neither
>given nor endorsed by it.
>
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake 



More information about the Cmake mailing list