<div class="gmail_quote">On Tue, Nov 1, 2011 at 10:43 AM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Tue, Nov 1, 2011 at 11:22 AM, Alexander Neundorf<br>
<<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>> wrote:<br>
> On Tuesday 01 November 2011, Robert Dailey wrote:<br>
>> For some reason the built in variable like MSVC_VERSION and MSVC do not<br>
>> have any value unless the project() command is called first. Can someone<br>
>> explain why?<br>
><br>
> Without checking...<br>
> IIRC, the project() call enables by default the C and the CXX languages (if<br>
> that hasn't been done before explicitely).<br>
> During enabling the languages the compilers are detected, and with them those<br>
> variables are set.<br>
> So, before that no languages are known to cmake, so these variables are not<br>
> set.<br>
><br>
> Alex<br>
</div></div>> --<br>
><br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
><br>
<br>
Alex is right.<br>
<br>
If you need the value of MSVC *before* calling the project command for<br>
some reason, then you can call enable_language(C) (or CXX) instead...</blockquote><div><br></div><div>I don't need MSVC checking before project() in my case, they just seemed unrelated so I wanted to check for educational purposes :)</div>
<div><br></div><div>Thanks guys. </div></div>