CMake cannot find Visual Studio 140 toolset on 2017 installation

The new Visual Studio 2017 installer has the option to install the older VS 140 compilation along with the new VS 141 toolset. This is an option in the 2017 installer

enter image description here

The installer successfully installs the v140 toolbox and I can even switch the toolbox between v140 and v141 in Visual Studio projects / solutions and build them successfully, but I cannot build the project with the v140 toolbox using CMake. When I ran

cmake -G"Visual Studio 14 2015" ../Source

      

cmake doesn't find compiler and toolbox.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!

      

However, as expected, I can build successfully with the option Visual Studio 15 2017

. Is there a way to use the old toolbox with cmake without installing VS2015?

+3


source to share


1 answer


You can specify a toolbox with a flag -T

when called cmake

. See documentation here and here .



+3


source







All Articles