Visual Studio 2015 generator can't identify toolchain under recent versions of Windows 10
Example output:
$ cmake -G "Visual Studio 14" ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:10 (enable_language):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (enable_language):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
The cause of the error is the presence of the WindowsTargetPlatformVersion
tag in the CompilerId project file:
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
Removing that line allows the msbuild invocation to succeed. I can also make it work by setting CMAKE_SYSTEM_VERSION
:
$ cmake -G "Visual Studio 14" -DCMAKE_SYSTEM_VERSION=8.1 ..
-- The C compiler identification is MSVC 19.0.23506.0
-- The CXX compiler identification is MSVC 19.0.23506.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/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 14.0/VC/bin/amd64_x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
The issue is that the 10.0.16299 is not supported by VS 2015. Using the VS 2015 installer options as a guide, VS 2015 is likely incompatible with any Windows 10 SDK beyond 10.0.10586. The later SDK was installed by the Visual Studio 2017 installer.