Cmake fails to identify the compiler with clean install of Visual Studio 2017 (15.4.2)
On a brand new computer with Windows 10 pro, I installed
- Visual Studio Community 2017, Version 15.4.2, including the Windows 10 SDK
- the latest version of CMake (tried 3.9.4 and 3.10.06rc3) both with default installation paths. Cmake fails with the following message
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.
where the error is due to not finding gdi32.lib
while attempting to compile CompilerIdC
and CompilerIdCXX
:
LINK : fatal error LNK1181: cannot open input file 'gdi32.lib'
This library (and the other set in CMAKE_C_STANDARD_LIBRARIES_INIT
) is present on my system: when editing by hand CompilerIdC.vcxproj to include the path of the libraries ("C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x64"), I can compile the project with Visual Studio.
I didn't manage to set up my environment variables to work around this problem, but anyhow, I would not expect CMake to have me play with that in order to work.