[CMake] Missing CMAKE_CONFIGURATION_TYPES with project NONE on Windows

Brad King brad.king at kitware.com
Fri May 10 11:14:56 EDT 2013


On 05/10/2013 10:31 AM, Paul Smith wrote:
> I've separated my project statement from:
> 
>   project(MyProject C CXX)
> 
> into:
> 
>   project(MyProject NONE)
>   enable_language(C)
>   enable_language(CXX)
> 
> on Windows (VS 10 Win64 generator):
> 
>   CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release;MinSizeRel;RelWithDebInfo
> 
> and after the above change it's:
> 
>   CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release

It looks like this behavior has been in there for a *long* time.
The VS generator selects the list of configurations here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalVisualStudio7Generator.cxx;hb=v2.8.10.2#l36

In the case that project enables languages then the first
EnableLanguage call there loads

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Platform/Windows-MSVC.cmake;hb=v2.8.10.2#l52

which selects the full configuration list.  In the case that the
project enables only "NONE" then the configuration list is not
initialized and falls through to the call to GenerateConfigurations:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalVisualStudio7Generator.cxx;hb=v2.8.10.2#l136

which selects only Debug and Release.

OTOH the Xcode generator just initializes all four configurations
in EnableLanguage up front:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalXCodeGenerator.cxx;hb=v2.8.10.2#l182

-Brad


More information about the CMake mailing list