[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
Thu May 8 21:32:29 EDT 2014


In CMakeCache.txt, for a Visual Studio based build where C and/or C++ 
has been enabled:

//CXX compiler
CMAKE_CXX_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual 
Studio 11.0/VC/bin/cl.exe

//C compiler
CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/Microsoft Visual 
Studio 11.0/VC/bin/cl.exe

Those are as rock solid a basis as you'll get for a "typical" visual 
studio build. I think it would be wiser to depend on those than on the 
CMAKE_LINKER variable.

Microsoft has a habit of assuming things like this are internal 
implementation details, though, and they often move things around from 
version to version.

So nothing is guaranteed.

But I would think the compiler variables would be better suited if you 
don't want to rely on ENV or registry... I would point out however, 
that you don't need to rely on any cmake vars or any cmake commands 
having been run if you go with ENV or registry.


HTH,
David C.



More information about the CMake mailing list