[CMake] Problems setting CMAKE_CONFIGURATION_TYPES for Visual Studio

gaga bla gagabla0 at gmail.com
Tue May 28 13:54:47 EDT 2013


Hello, I have problems reducing available configuration types for a Visual
Studio project.

No matter what I do, the project always contains all four configuration
types.



I have two files involved, I tried to strip everything that seemed to be
unimportant:



CmakeLists.txt (Main file):

------------------------------------

include("... Helpers.cmake")

configureMyProject("MyProject")

message("Config types (outside): ${CMAKE_CONFIGURATION_TYPES}")

------------------------------------



Helpers.cmake:

------------------------------------

if(__myhelpers)

                return()

endif()

set(__myhelpers YES)



function(configureMyProject MY_NAME ........)

  set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
FORCE)

  message("Config types (before): ${CMAKE_CONFIGURATION_TYPES}")

  project(${MY_NAME})

  message("Config types (after): ${CMAKE_CONFIGURATION_TYPES}")

  set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
FORCE)

  message("Config types (after 2): ${CMAKE_CONFIGURATION_TYPES}")

  ...

  add_library(...)

  ...

endfunction()

------------------------------------



I then get the following output:

------------------------------------

Config types (before): Debug;RelWithDebInfo

Config types (after): Debug;Release;MinSizeRel;RelWithDebInfo

Config types (after 2): Debug;RelWithDebInfo

Config types (outside): Debug;RelWithDebInfo

------------------------------------



So it seems to me, that the call of the project-function resetted the
configuration types and created then the project accordingly.

Is this a bug or am I doing something wrong? Does anyone know a workaround?



Kind regards

Janosch Scharlipp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130528/dc513d07/attachment.htm>


More information about the CMake mailing list