Clion: CMake Error: MSVC is not able to compile a simple test program
When I use CLion to configure my project, it outputs the following message when loading my CMakeLists.txt:
E:\Jetbrains\apps\CLion\ch-0\231.8770.66\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=E:/Jetbrains/apps/CLion/ch-0/231.8770.66/bin/ninja/win/x64/ninja.exe -G Ninja -S E:\vulkan_test -B E:\vulkan_test\cmake-build-debug
Current VCPKG PATH:E:/vcpkg
-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - broken
CMake Error at E:/Jetbrains/apps/CLion/ch-0/231.8770.66/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: E:/vulkan_test/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-fbpzvh
Run Build Command(s):E:/Jetbrains/apps/CLion/ch-0/231.8770.66/bin/ninja/win/x64/ninja.exe cmTC_418ae && [1/2] Building C object CMakeFiles\cmTC_418ae.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_418ae.exe
FAILED: cmTC_418ae.exe
cmd.exe /C "cd . && E:\Jetbrains\apps\CLion\ch-0\231.8770.66\bin\cmake\win\x64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_418ae.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\mt.exe --manifests -- C:\PROGRA~2\MIB055~1\2019\PROFES~1\VC\Tools\MSVC\1429~1.301\bin\Hostx86\x64\link.exe /nologo CMakeFiles\cmTC_418ae.dir\testCCompiler.c.obj /out:cmTC_418ae.exe /implib:cmTC_418ae.lib /pdb:cmTC_418ae.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D E:\vulkan_test\cmake-build-debug\CMakeFiles\CMakeScratch\TryCompile-fbpzvh && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file E:/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary E:/vulkan_test/cmake-build-debug/CMakeFiles/CMakeScratch/TryCompile-fbpzvh/cmTC_418ae.exe -installedDir E:/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
'cmd.exe' is not recognized as an internal or external command,
operable program or batch file.
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:15 (project)
-- Configuring incomplete, errors occurred!
See also "E:/vulkan_test/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "E:/vulkan_test/cmake-build-debug/CMakeFiles/CMakeError.log".
Please sign in to leave a comment.
Here is my CMakeList.txt:
I also checked my environment variables, C:/Windows/System32 is in my PATH:
And I can run the command manually in my Windows Terminal without errors: