[CMake] How to find vcvarsall.bat (e.g. at "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC")? CMAKE_LINKER?

David Cole dlrdave at aol.com
Fri May 9 05:53:32 EDT 2014


> Does CMAKE_CXX_COMPILER always provide the full path name of the
> compiler, when we use the current version of CMake (2.8.12.2)? In the
> past it did not, apparently, as a CMakeCache.txt file generated by
> CMake 2.8.8 simply had "cl" as compiler file path

I think now it does, but I'm not 100% certain if it's guaranteed to be
true. Or, if guaranteed, what version of CMake it started being that
way. Maybe Brad will chime in and confirm or deny, and mention the
version if he knows it...

The thing I do know is that since the compiler ID stuff was refactored
and re-architected, there is a directory in your build tree named
"CMakeFiles/${CMAKE_VERSION}" and it contains the file
"CMakeCXXCompiler.cmake" (among others) with all of the information
about the enabled C++ compiler in it. This file is loaded by CMake even
if that information does not appear in your CMakeCache.txt, so the
variable CMAKE_CXX_COMPILER should have a consistent value from run to
run, even if it's not stored in the cache file directly.

Be aware that this file will be re-generated by the next version of
CMake if you upgrade CMake and run it in a pre-existing build
directory, it will create all of its own support files like those in
its very own version-named directory, and the ones from the older
version of CMake are ignored. For this, and many other reasons, it is
always best to start with a clean build tree when switching versions of
CMake.


HTH,
David C.



More information about the CMake mailing list