[CMake] How to find vcvarsall.bat (e.g. at "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC")? CMAKE_LINKER?
Niels Dekker - address until 2018
niels_dekker_address_until_2018 at xs4all.nl
Thu May 8 16:44:22 EDT 2014
We need to find a file named "vcvarsall.bat", located in the
installation directory of Visual C++, which may have one of the
following path names, for example:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
"M:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\"
"C:\Program Files\Microsoft Visual Studio 9.0\VC\"
etc.
How can we retrieve this directory path name within our CMakeLists.txt?
There's no standard CMake variable like ${CMAKE_COMPILER_DIR}, right?
Looking at a CMakeCache.txt file generated for Visual C++ 12 (2013) by
CMake 2.8.12.2, I saw exactly one variable that would help us:
CMAKE_LINKER:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio
12.0/VC/bin/link.exe
From there, we can easily find the path to the corresponding
"vcvarsall.bat". However, ${CMAKE_LINKER} appears to be left
undocumented intentionally, as it appears to be an internal variable:
0008065: CMAKE_LINKER not mentioned on --help-variables
http://www.cmake.org/Bug/view.php?id=8065
Closed as "won't fix"
Does that mean we should not use ${CMAKE_LINKER}? If so, do you have
another suggestion on how to find "vcvarsall.bat"?
Kind regards, Niels
--
Niels Dekker
Scientific programmer
LKEB, Leiden University Medical Center
More information about the CMake
mailing list