<div class="gmail_quote">On Tue, Nov 1, 2011 at 10:43 AM, David Cole <span dir="ltr">&lt;<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>&gt;</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>
&lt;<a href="mailto:a.neundorf-work@gmx.net">a.neundorf-work@gmx.net</a>&gt; wrote:<br>
&gt; On Tuesday 01 November 2011, Robert Dailey wrote:<br>
&gt;&gt; For some reason the built in variable like MSVC_VERSION and MSVC do not<br>
&gt;&gt; have any value unless the project() command is called first. Can someone<br>
&gt;&gt; explain why?<br>
&gt;<br>
&gt; Without checking...<br>
&gt; IIRC, the project() call enables by default the C and the CXX languages (if<br>
&gt; that hasn&#39;t been done before explicitely).<br>
&gt; During enabling the languages the compilers are detected, and with them those<br>
&gt; variables are set.<br>
&gt; So, before that no languages are known to cmake, so these variables are not<br>
&gt; set.<br>
&gt;<br>
&gt; Alex<br>
</div></div>&gt; --<br>
&gt;<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
&gt;<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&#39;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>