Ali
Ali

Reputation: 1041

CMake cannot find Visual Studio 140 toolset on a 2017 installation

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

enter image description here

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

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

cmake fails to find the compiler and toolset.

-- 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 successfully build with the Visual Studio 15 2017 option. Is there any way to use the older toolset with cmake without installing VS2015?

Upvotes: 4

Views: 2457

Answers (1)

arrowd
arrowd

Reputation: 34391

You can specify toolsets with -T flag when calling cmake. See the documentation here and here.

Upvotes: 4

Related Questions