[Cmake] MSDev multiple build types

Dekeyser, Kris Kris.Dekeyser at lms.be
Mon Aug 23 08:51:19 EDT 2004


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.



More information about the Cmake mailing list