[CMake] Missing CMAKE_CONFIGURATION_TYPES with project NONE on Windows

Paul Smith paul at mad-scientist.net
Fri May 10 11:23:22 EDT 2013


On Fri, 2013-05-10 at 11:14 -0400, Brad King wrote:
> 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.

Yes, I was just coming back to confirm it still happens with CMake
2.8.11-rc4.

Is there any way to work around this?  I've tried setting
CMAKE_CONFIGURATION_TYPES before project(), after project and before
enable_language(), and after enable_language() and nothing works.

:-(.


The only thing I've tried so far that seems to work on Windows (haven't
gone back to try it on the other platforms) is to put the project()
definition inside an if():

  if(WIN32)
      project(MyProject C CXX)
  else()
      project(MyProject NONE)
  endif()
   ...
  if(NOT WIN32)
      enable_language(C)
      enable_language(CXX)
  endif()

I don't know if this will have other bad effects.  It surely is
unpleasant.



More information about the CMake mailing list