Hi: I'm trying to create a 64-bit Visual Studio 12 (aka 2013) project with CMake 3.0.2. My CMakeLists.txt file is really simple:
cmake_minimum_required( VERSION 3.0 ) project( cmc CXX ) # What compiler did we find? message( "C++: ${CMAKE_CXX_COMPILER}" ) >From a windows shell I do: > c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\vcvars64.bat > cmake -G "Visual Studio 12 Win64" . -- The CXX compiler identification is MSVC 18.0.31101.0 -- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- Check for working CXX compiler using: Visual Studio 12 2013 Win64 -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done C++: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- Configuring done -- Generating done -- Build files have been written to: C:/Users/dbarnett/cmc/build So, it appears to find the compiler OK since it emits the correct compiler identification. But, the actual value of CMAKE_CXX_COMPILER is not usable. If you try to execute C:/Program..../x86_amd64/cl.exe from within a CMake script or even from the command line, it will fail and produce the well-known "0xc000007b" dialog (missing DLL). Unless you've sourced vcvarsx86_amd64.bat, the correct environment variables are not set for this version of the compiler. On the other hand, if I do "cmake -G NMake Makefiles", I get what I expect: -- The CXX compiler identification is MSVC 18.0.31101.0 -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done C++: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- Configuring done -- Generating done -- Build files have been written to: C:/Users/dbarnett/cmc/other Namely, it finds C:/Program..../amd64/cl.exe. I've looked through the CMake Modules, but I could not really find the place where CMake derives the value for CMAKE_CXX_COMPILER when you generate a VS project. Could someone point me to the source code where this occurs? I would like to see how it is coming up with this version of the compiler which isn't even in the PATH. Thanks, Allen
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake