Skip to content

VS2017: Verify Windows 8.1 SDK before using it

Roger Leigh requested to merge rleigh/cmake:vs2017-sdk-detection into master

Don't report it as being found just because an appropriate registry entry exists. Also check that a suitable header from the kit is available, as done in the cmGlobalVisualStudio14Generator class for the 10.0 SDK.

See issue #16811 (closed)

Testing with VS2017 Community without the 8.1 SDK installed (it's not installed by default, so it will be expected to be missing for most installs):

Without this MR:

C:\build\s3>cmake -G "Visual Studio 15 2017 Win64" h:\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!

With this MR:

C:\build\s4>cmake -G "Visual Studio 15 2017 Win64" h:\multiarray
-- The CXX compiler identification is MSVC 19.10.25019.0
-- The C compiler identification is MSVC 19.10.25019.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.10.25017/bin/HostX86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done

It likely also needs testing on a system with the 8.1 SDK installed, to verify that the logic is correct for this configuration as well.

Merge request reports