[CMake] CMake Visual Studio Configuration Single

David Cole dlrdave at aol.com
Mon Jun 30 06:09:55 EDT 2014


You can set CMAKE_CONFIGURATION_TYPES to your own list of 
configurations (including limiting it to a single configuration) as 
long as you set it *before* the project command in your CMakeLists.txt 
file. This technique works with the Visual Studio and Xcode generators. 
See the following bug reports for reference.

    http://www.cmake.org/Bug/view.php?id=6788
    http://www.cmake.org/Bug/view.php?id=8914

I'm not sure why you would recommend anything related to 
CMAKE_BUILD_TYPE for the Visual Studio generators. I would be curious 
to know exactly how you are using it, because internally, 
CMAKE_BUILD_TYPE (to the best of my knowledge) is completely ignored by 
the Visual Studio generators. Any positive things happening in your 
project because of your use of it must be because of the way you use it 
in your CMakeLists files... I'm thinking it's probably only used at 
CMake time, unless you're passing it as args to custom commands or 
something... in which case, you'll be passing the same CMake configure 
time CMAKE_BUILD_TYPE value regardless of what config your end user 
chooses to build in Visual Studio. Which would be confusing at best.

VS and Xcode use a list of configurations, with the "active" 
configuration chosen at build time by the developer. Makefile and ninja 
systems use CMAKE_BUILD_TYPE -- VS and Xcode do not.


HTH,
David C.



More information about the CMake mailing list