CMake config error when opening the project in VS2019
NipunRamani99 opened this issue · comments
n1ps commented
Hi I am trying to open anki in VS2019 however I am getting the following config error.
1> Provided 'inheritEnvironments' doesn't provide the necessary environment variables needed to set the context for the configuration x64-Release. You can work around this by adding the necessary environment variables such as INCLUDE, LIBPATH, PATH and others to an environment block in your CMakeSettings.json.
1> CMake generation started for configuration: 'x64-Release'.
1> Command line: "cmd.exe" /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Laptop.000\Source\Repos\anki-3d-engine\out\install\x64-Release" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Laptop.000\Source\Repos\anki-3d-engine" 2>&1"
1> Working directory: C:\Users\Laptop.000\Source\Repos\anki-3d-engine\out\build\x64-Release
1> [CMake] -- The C compiler identification is MSVC 19.24.28316.0
1> [CMake] -- The CXX compiler identification is MSVC 19.24.28316.0
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe -- broken
1> [CMake] CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
1> [CMake] The C compiler
1> [CMake]
1> [CMake] "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/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: C:/Users/Laptop.000/Source/Repos/anki-3d-engine/out/build/x64-Release/CMakeFiles/CMakeTmp
1> [CMake]
1> [CMake] Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_7fd5f && [1/2] Building C object CMakeFiles\cmTC_7fd5f.dir\testCCompiler.c.obj
1> [CMake] [2/2] Linking C executable cmTC_7fd5f.exe
1> [CMake] FAILED: cmTC_7fd5f.exe
1> [CMake] cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_7fd5f.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_7fd5f.dir\testCCompiler.c.obj /out:cmTC_7fd5f.exe /implib:cmTC_7fd5f.lib /pdb:cmTC_7fd5f.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] LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1424~1.283\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_7fd5f.dir\testCCompiler.c.obj /out:cmTC_7fd5f.exe /implib:cmTC_7fd5f.lib /pdb:cmTC_7fd5f.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 /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_7fd5f.dir/intermediate.manifest CMakeFiles\cmTC_7fd5f.dir/manifest.res" failed (exit code 1104) with the following output:
1> [CMake] LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
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:5 (PROJECT)
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "C:/Users/Laptop.000/Source/Repos/anki-3d-engine/out/build/x64-Release/CMakeFiles/CMakeOutput.log".
1> [CMake] See also "C:/Users/Laptop.000/Source/Repos/anki-3d-engine/out/build/x64-Release/CMakeFiles/CMakeError.log".
1> [CMake]
1> cmd.exe /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Laptop.000\Source\Repos\anki-3d-engine\out\install\x64-Release" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "C:\Users\Laptop.000\Source\Repos\anki-3d-engine" 2>&1" returned with exit code: 1
seemed to me that I was missing Windows SDK but I double checked and it's installed. I tried to manually run cmake through powershell and it's working fine. I used Visual Studio 16 as generator instead of Ninja (Which is used in the case above). Any idea how to fix this?
n1ps commented
Updating vs2019 seems to fix the issue.