[CMake] MSVC variable doesn't work without project() call first

Alexander Neundorf a.neundorf-work at gmx.net
Tue Nov 1 11:22:47 EDT 2011


On Tuesday 01 November 2011, Robert Dailey wrote:
> For some reason the built in variable like MSVC_VERSION and MSVC do not
> have any value unless the project() command is called first. Can someone
> explain why?

Without checking...
IIRC, the project() call enables by default the C and the CXX languages (if 
that hasn't been done before explicitely).
During enabling the languages the compilers are detected, and with them those 
variables are set.
So, before that no languages are known to cmake, so these variables are not 
set.

Alex


More information about the CMake mailing list