Problem with cmake hellow world template
Kesanov opened this issue · 0 comments
Kesanov commented
Description
When I create a brand new CMake project from template in Visual Studio, I get a Cmake error:
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_C_COMPILER:STRING="cl.exe" -DCMAKE_CXX_COMPILER:STRING="cl.exe" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:/Hi/out/install/x64-debug" -DCMAKE_MAKE_PROGRAM="E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\Ninja\ninja.exe" "D:\Hi" 2>&1"
1> Working directory: D:/Hi/out/build/x64-debug
1> [CMake] -- The C compiler identification is MSVC 19.33.31629.0
1> [CMake] -- The CXX compiler identification is MSVC 19.33.31629.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - failed
1> [CMake] -- Check for working C compiler: E:/VisualStudio/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe
1> [CMake] -- Check for working C compiler: E:/VisualStudio/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - broken
1> [CMake] CMake Error at E:/VisualStudio/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
1> [CMake] The C compiler
1> [CMake]
1> [CMake] "E:/VisualStudio/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe"
1> [CMake]
1> [CMake] is not able to compile a simple test program.
1> [CMake]
1> [CMake] It fails with the following output:
1> [CMake]
1> [CMake] Change Dir: D:/Hi/out/build/x64-debug/CMakeFiles/CMakeTmp
1> [CMake]
1> [CMake] Run Build Command(s):E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\Ninja\ninja.exe cmTC_deaf4 && [1/2] Building C object CMakeFiles\cmTC_deaf4.dir\testCCompiler.c.obj
1> [CMake] [2/2] Linking C executable cmTC_deaf4.exe
1> [CMake] FAILED: cmTC_deaf4.exe
1> [CMake] cmd.exe /C "cd . && E:\VisualStudio\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_deaf4.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests -- E:\VisualStudio\VC\Tools\MSVC\14.33.31629\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_deaf4.dir\testCCompiler.c.obj /out:cmTC_deaf4.exe /implib:cmTC_deaf4.lib /pdb:cmTC_deaf4.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 && cd ."
1> [CMake] The system cannot find the path specified.
1> [CMake] ninja: build stopped: subcommand failed.
1> [CMake]
1> [CMake]
1> [CMake]
1> [CMake]
1> [CMake]
1> [CMake] CMake will not be able to correctly generate this project.
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:6 (project)
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "D:/Hi/out/build/x64-debug/CMakeFiles/CMakeOutput.log".
1> [CMake] See also "D:/Hi/out/build/x64-debug/CMakeFiles/CMakeError.log".
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_C_COMPILER:STRING="cl.exe" -DCMAKE_CXX_COMPILER:STRING="cl.exe" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:/Hi/out/install/x64-debug" -DCMAKE_MAKE_PROGRAM="E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\Ninja\ninja.exe" "D:\Hi" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_C_COMPILER:STRING="cl.exe" -DCMAKE_CXX_COMPILER:STRING="cl.exe" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:/Hi/out/install/x64-debug" -DCMAKE_MAKE_PROGRAM="E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\Ninja\ninja.exe" "D:\Hi" 2>&1"' returned with exit code: 1'.
Most likely due to incorrect "
placement in:
cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft...
Here, the "cd
should be likely just cd .
And also in:
'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "E:\VISUALSTUDIO\COMMON7\IDE\COMMONEXTENSIONS\Microsoft\CMake\CMake\bin\cmake.exe"
Here, the "%SYSTEMROOT%\System32\chcp.com
should be likely "%SYSTEMROOT%\System32\chcp.com"
instead.
Reproduction Steps
Create a Cmake Hello World from a template.
Do Project/Delete Cache & Reconfigure.
Check the Cmake output.
Visual Studio 2022. MSVCx64