VS2017 SDK selection during configuration assumes presence of 8.1 SDK
There seems to be a problem with VS2017 and the 8.1/10.0 SDKs. Testing configuration of a trivial C++ project with CMake 3.8.0 and an up-to-date VS2017 community desktop installation:
D:\test>cmake -G "Visual Studio 15 2017 Win64" h:\code\multiarray
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:42 (project):
No CMAKE_CXX_COMPILER could be found.
CMake Error at CMakeLists.txt:42 (project):
No CMAKE_C_COMPILER could be found.
-- Configuring incomplete, errors occurred!
in the error log:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 16/04/2017 19:50:35.
Project "D:\test\CMakeFiles\3.8.0\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\x64\PlatformToolsets\v141\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [D:\test\CMakeFiles\3.8.0\CompilerIdCXX\CompilerIdCXX.vcxproj]
Done Building Project "D:\test\CMakeFiles\3.8.0\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets) -- FAILED.
I have the 10.0.15063.0
SDK installed (the current 2017 default). I don't have the 8.1
SDK installed.
I'm unsure why the CMake check here is specifically requiring the 8.1 SDK, rather than using the default one which was installed by the VS2017 installer. I have not made any specific selection of an SDK here, so my expectation would be that CMake would not have enforced the assumption that 8.1 was required, when there's another viable SDK to choose from. That said, my understanding of the byzantine world of Windows may well not be complete either, and I may have missed some subtle complication.
Kind regards, Roger