问题
I am calling cmake -G "NMake Makefiles" from a Microsoft Visual C++ 2010 x64 command prompt. The C compiler identification is correct, but the CXX compiler identification not.
I am really confused, because it has worked before, but I could not determine what changed (Windows update?) and raised this issue. So I am searching for the root for this problem.
How does CMake find the cxx compiler (on Windows: cl.exe
) and maybe how do I change this behavior? (Setting CMAKE_CXX_COMPILER seems not to have any effect.)
Here the strange output of CMake:
The C compiler identification is MSVC 16.0.40219.1
The CXX compiler identification is unknown
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC /bin/amd64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/amd64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe
CMake Error: your CXX compiler: "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/x86_amd64/cl.exe" is not able to compile a simple test program.
Visual Studio 9 is not installed on this machine (Where on earth is the path C:/Program Files (x86)/Microsoft Visual Studio 9.0
coming from? It does not exit on this machine, and I did not type it anywhere in CMake.)
CMake (output above) was called from a Visual Studio command prompt. This call reproduces this issue:
call "%VS100COMNTOOLS%"\..\..\VC\bin\amd64\vcvars64.bat
cmake -G "NMake Makefiles" C:\base_repos\free
Visual Studio 2010 Ultimate (SP1 installed)
来源:https://stackoverflow.com/questions/23477379/how-does-cmake-find-the-cxx-compiler