On Thu, Mar 15, 2012 at 6:46 AM, Bill Hoffman <span dir="ltr"><<a href="mailto:bill.hoffman@kitware.com">bill.hoffman@kitware.com</a>></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 "Visual Studio 9 2008" 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't figure out how it'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 "C compiler" NO_DEFAULT_PATH)<br>
ENDIF (_CMAKE_USER_CXX_COMPILER_<u></u>PATH)<br>
FIND_PROGRAM(CMAKE_C_COMPILER NAMES ${CMAKE_C_COMPILER_LIST} DOC "C<br>
compiler")<br>
<br>
IF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)<br>
SET(CMAKE_C_COMPILER "${CMAKE_C_COMPILER_INIT}" CACHE FILEPATH "C<br>
compiler" FORCE)<br>
ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER)<br>
<br>
I believe the CMAKE_C_COMPILER_LIST contains "cl" as is the default of<br>
CMAKE_GENERATOR_CC for VS generators.<br>
<br>
Typically VS isn't in the default path, so the first two FIND_PROGRAM<br>
commands don't yield any usable results. Then the next block sets the<br>
CMAKE_C_COMPILER to "cl", and everything is OK, because if it'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'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'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>