Visual Studio 15 2017 generator does not work after installing the WDK
Repro steps:
Install CMake 3.14.0-rc1 on Windows. Install Visual Studio 2017 15.9 Community. Create a simple CMake project. On the command line, generate using the Visual Studio 15 2017 generator. Note that generation succeeds.
Install the WDK Windows 10.0.17763.1. Delete CMakeCache.txt and attempt to generate again. Generation now fails:
-- Building for: Visual Studio 15 2017
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
Manually specifying the C and C++ compiler paths reveals an issue with linking MSVCRT.lib:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe -- broken
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/bemcmorr/CMakeBuilds/c4f55ea7-6e23-fc33-9dc3-cd536011ca74/build/x64-Debug/CMakeFiles/CMakeTmp
Run Build Command:"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe" "cmTC_8ff3e.vcxproj" "/p:Configuration=Debug" "/p:Platform=Win32" "/p:VisualStudioVersion=15.0"
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2/14/2019 12:26:03 AM.
Project "C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTC_8ff3e.dir\Debug\".
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(402,5): warning MSB8038: Spectre mitigation is enabled but Spectre mitigated libraries are not found. Verify that the Visual Studio Workload includes the Spectre mitigated libraries. See https://aka.ms/Ofhn4c for more information. [C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj]
Creating directory "C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_8ff3e.dir\Debug\cmTC_8ff3e.tlog\".
InitializeBuildStatus:
Creating "cmTC_8ff3e.dir\Debug\cmTC_8ff3e.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\CL.exe /c /W1 /WX- /diagnostics:classic /O2 /Oy- /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Qspectre /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_8ff3e.dir\Debug\\" /Fd"cmTC_8ff3e.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\testCCompiler.c"
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27027.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
testCCompiler.c
cl /c /W1 /WX- /diagnostics:classic /O2 /Oy- /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Qspectre /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_8ff3e.dir\Debug\\" /Fd"cmTC_8ff3e.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\testCCompiler.c"
Link:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\Debug\cmTC_8ff3e.exe" /INCREMENTAL /NOLOGO /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/bemcmorr/CMakeBuilds/c4f55ea7-6e23-fc33-9dc3-cd536011ca74/build/x64-Debug/CMakeFiles/CMakeTmp/Debug/cmTC_8ff3e.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/bemcmorr/CMakeBuilds/c4f55ea7-6e23-fc33-9dc3-cd536011ca74/build/x64-Debug/CMakeFiles/CMakeTmp/Debug/cmTC_8ff3e.lib" /MACHINE:X86 /SAFESEH cmTC_8ff3e.dir\Debug\testCCompiler.obj
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' [C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj]
Done Building Project "C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj" (default target) (1) ->
(PrepareForBuild target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(402,5): warning MSB8038: Spectre mitigation is enabled but Spectre mitigated libraries are not found. Verify that the Visual Studio Workload includes the Spectre mitigated libraries. See https://aka.ms/Ofhn4c for more information. [C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj]
"C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj" (default target) (1) ->
(Link target) ->
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib' [C:\Users\bemcmorr\CMakeBuilds\c4f55ea7-6e23-fc33-9dc3-cd536011ca74\build\x64-Debug\CMakeFiles\CMakeTmp\cmTC_8ff3e.vcxproj]
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.71
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
-- Configuring incomplete, errors occurred!