On Thu, Mar 15, 2012 at 6:46 AM, Bill Hoffman <span dir="ltr">&lt;<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">On 3/14/2012 6:39 PM, James Bigler wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a system with several copies of Visual Studio installed.<br>
<br>
When I set the generator for &quot;Visual Studio 9 2008&quot; it ends up picking<br>
up a different compiler:<br>
<br>
CMAKE_C_COMPILER:FILEPATH=C:/<u></u>Program Files (x86)/SCE/Common/VSI/bin/cl.<u></u>exe<br>
<br>
I think this is because of the following code in<br>
CMakeDetermineCCompiler.cmake (which I can&#39;t figure out how it&#39;s invokes<br>
by the cmake-gui or cmake.exe):<br>
<br>
   # Find the compiler.<br>
   IF (_CMAKE_USER_CXX_COMPILER_<u></u>PATH)<br>
     FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} PATHS<br>
${_CMAKE_USER_CXX_COMPILER_<u></u>PATH} DOC &quot;C compiler&quot; NO_DEFAULT_PATH)<br>
   ENDIF (_CMAKE_USER_CXX_COMPILER_<u></u>PATH)<br>
   FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC &quot;C<br>
compiler&quot;)<br>
<br>
   IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)<br>
     SET(CMAKE_C_COMPILER &quot;${CMAKE_C_COMPILER_INIT}&quot; CACHE FILEPATH &quot;C<br>
compiler&quot; FORCE)<br>
   ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)<br>
<br>
I believe the CMAKE_C_COMPILER_LIST contains &quot;cl&quot; as is the default of<br>
CMAKE_GENERATOR_CC for VS generators.<br>
<br>
Typically VS isn&#39;t in the default path, so the first two FIND_PROGRAM<br>
commands don&#39;t yield any usable results.  Then the next block sets the<br>
CMAKE_C_COMPILER to &quot;cl&quot;, and everything is OK, because if it&#39;s run from<br>
within the project, VS sets the paths so its cl.exe is first.<br>
<br>
However if there is another cl.exe in the system PATH, then that version<br>
will get picked up by the second FIND_PROGRAM, and thus cause a bit of<br>
trouble later on when the copies of cl.exe aren&#39;t the same.<br>
<br>
Does this seem like a bug to anyone?  It seems like if you would want cl<br>
to point to the same version as your copy of Visual Studio.  Perhaps<br>
$(VCInstallDir) could be used with a custom command to generate what VS<br>
thinks the path should be?<br>
<br>
Anyone have any thoughts?<br>
<br>
I&#39;m using CMake 2.8.2 and 2.8.6 on windows.<br>
<br>
</blockquote>
<br></div></div>
So, with the IDE generators CMake should not even look for cl.  It does not use that value anyway.<br>
<br>
-Bill<br>
<br>
--<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/<u></u>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/<u></u>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/<u></u>listinfo/cmake</a><br>
</blockquote></div><br>OK, but it does try to fill in the CMAKE_C_COMPILER value.  What are you suggesting?  That this is a bug or some kind of mistake on my part thinking that the value in CMAKE_C_COMPILER is somehow relevant for Visual Studio targets?<br>

<br>Thanks,<br>James<br>