[CMake] Missing CMAKE_CONFIGURATION_TYPES with project NONE on Windows
Andreas Mohr
andi at lisas.de
Tue May 14 15:08:31 EDT 2013
On Tue, May 14, 2013 at 10:48:22AM -0400, cmake-request at cmake.org wrote:
> On 05/10/2013 11:14 AM, Brad King wrote:
> > 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
>
> I've now taught the VS generator to do the same:
>
> http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=42bb42d1
>
> -Brad
Which sounds like a very good idea, given that my usual
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message(SEND_ERROR/FATAL_ERROR "forgot to setup CMAKE_BUILD_TYPE on single-config generator, you doofy!")
endif(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
fails terribly on MSVC (note non-NONE project()s...)
due to not having these populated during initial configure run
(thus one needs to relax it to SEND_ERROR at a minimum!).
Workaround is to insure against this via some known always-there CACHE vars,
e.g. CMAKE_MAKE_PROGRAM and CMAKE_LINKER(??),
if(exists) set(cache_is_populated TRUE)
I hate to mention it, but you might want to wrap it into a new policy
setting since some build environments might have hard expectations about
that behaviour. OTOH you seem to indicate it's specific to certain
generators only, thus behaviour over various generator types *is* varied already
thus people should have known to deal properly with it.
Thus: thanks for that fix,
Andreas Mohr
--
GNU/Linux. It's not the software that's free, it's you.
More information about the CMake
mailing list