Open lygstate opened 3 years ago
Thank you for the idea, I was not aware of this user scenario for the vcvars script. We may not be able to implement this immediately but we will monitor the community reactions (please give a thumbs up on the first entry of this GitHub issue) to find how this best fits in our backlog.
@lygstate, I just tried -vcvars_ver=14.0 for a VS 2019 vcvarsall.bat and it points to a VS 14.0 installation (as opposed to some different toolset with the same version but placed within the VS 2019 location). And that VS 14.0 is detected already as a kit by this extension. Please give us a few more details about what is not working now, how do you run vcvars, what toolset is using and from where, is it not present in cmake-tools-kits.json already?
@lygstate, I just tried -vcvars_ver=14.0 for a VS 2019 vcvarsall.bat and it points to a VS 14.0 installation (as opposed to some different toolset with the same version but placed within the VS 2019 location). And that VS 14.0 is detected already as a kit by this extension. Please give us a few more details about what is not working now, how do you run vcvars, what toolset is using and from where, is it not present in cmake-tools-kits.json already?
Yeap, that's what I want, currently the vscode cmake tools didn't detect vs2015 by using -vcvars_ver=14.0 when vs 2019 installed. And detecting directly with "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" will fail building when the newest windows sdk are installed(The rc.exe can not found).
Just to confirm, you are opening VSCode from a terminal where you didn't run vcvars yourself, right? You know that the extension does this when needed: run the appropriate vcvars script, from the correct location, with the correct arguments.... well ideally, there can always be bugs about that.
So you have both VS 2019 and VS 2015 installed and you don't see any VS 2015 kits detected when scanning for kits? And before (before installing latest sdk if I understand correctly) VS 2015 was found by the kits scan? I haven't seen this, VS 2015 is properly detected where I tried this. I'll brainstorm more about why this can happen and I'll see what else I can try to reproduce this.
What's a "cmake.loggingLevel": "Debug" logging in the "CMake/Build" output channel after scanning for kits?
This is used to resolve the following issue: The vs2015 installed with vs2019 can not be used, because using newest SDK along with vs vs2019
[main] Configuring folder: acrop-cat1-device
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_GENERATOR:STRING=Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/CI-Cor/acrop/acrop-cat1-device -Be:/CI-Cor/acrop/acrop-cat1-device/build/ninja-x64-pc-windows-msvc-14-debug
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is MSVC 19.0.24245.0
[cmake] -- The CXX compiler identification is MSVC 19.0.24245.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: E:/CI-Cor/acrop/acrop-cat1-device/build/ninja-x64-pc-windows-msvc-14-debug/CMakeFiles/CMakeTmp
[cmake]
[cmake] Run Build Command(s):C:/PROGRA~1/CMake/bin/ninja.exe cmTC_e4435 && [1/2] Building C object CMakeFiles\cmTC_e4435.dir\testCCompiler.c.obj
[cmake] [2/2] Linking C executable cmTC_e4435.exe
[cmake] FAILED: cmTC_e4435.exe
[cmake] cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_e4435.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~3.0\VC\bin\amd64\link.exe /nologo CMakeFiles\cmTC_e4435.dir\testCCompiler.c.obj /out:cmTC_e4435.exe /implib:cmTC_e4435.lib /pdb:cmTC_e4435.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 ."
[cmake] RC Pass 1: command "rc /fo CMakeFiles\cmTC_e4435.dir/manifest.res CMakeFiles\cmTC_e4435.dir/manifest.rc" failed (exit code 0) with the following output:
[cmake] 系统找不到指定的文件。
[cmake] ninja: build stopped: subcommand failed.
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "E:/CI-Cor/acrop/acrop-cat1-device/build/ninja-x64-pc-windows-msvc-14-debug/CMakeFiles/CMakeOutput.log".
[cmake] See also "E:/CI-Cor/acrop/acrop-cat1-device/build/ninja-x64-pc-windows-msvc-14-debug/CMakeFiles/CMakeError.log".
[main] Configuring folder: win-polyfill
[driver] Removing e:/CI-Cor-Ready/15/im/win-polyfill/build/i686-pc-windows-msvc-14-debug/CMakeCache.txt
[driver] Removing e:\CI-Cor-Ready\15\im\win-polyfill\build\i686-pc-windows-msvc-14-debug\CMakeFiles
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli "-DCMAKE_PREFIX_PATH=C:/Qt/Qt5.9.9/5.9.9/msvc2015_64;D:/Qt/Qt5.9.9/5.9.9/msvc2015_64" -DBUILD_TESTING:BOOL=TRUE -DCMAKE_EXE_LINKER_FLAGS_INIT=/SUBSYSTEM:CONSOLE,5.01 -DCMAKE_C_STANDARD_LIBRARIES= -DCMAKE_CXX_STANDARD_LIBRARIES= -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -He:/CI-Cor-Ready/15/im/win-polyfill -Be:/CI-Cor-Ready/15/im/win-polyfill/build/i686-pc-windows-msvc-14-debug -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is MSVC 19.0.24245.0
[cmake] -- The CXX compiler identification is MSVC 19.0.24245.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe
[cmake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64_x86/cl.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: E:/CI-Cor-Ready/15/im/win-polyfill/build/i686-pc-windows-msvc-14-debug/CMakeFiles/CMakeTmp
[cmake]
[cmake] Run Build Command(s):C:/PROGRA~1/CMake/bin/ninja.exe cmTC_b7466 && [1/2] Building C object CMakeFiles\cmTC_b7466.dir\testCCompiler.c.obj
[cmake] [2/2] Linking C executable cmTC_b7466.exe
[cmake] FAILED: cmTC_b7466.exe
[cmake] cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_b7466.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~3.0\VC\bin\AMD64_~2\link.exe /nologo CMakeFiles\cmTC_b7466.dir\testCCompiler.c.obj /out:cmTC_b7466.exe /implib:cmTC_b7466.lib /pdb:cmTC_b7466.pdb /version:0.0 /SUBSYSTEM:CONSOLE,5.01 /machine:X86 /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 ."
[cmake] RC Pass 1: command "rc /fo CMakeFiles\cmTC_b7466.dir/manifest.res CMakeFiles\cmTC_b7466.dir/manifest.rc" failed (exit code 0) with the following output:
[cmake] 系统找不到指定的文件。
[cmake] ninja: build stopped: subcommand failed.
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:5 (project)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "E:/CI-Cor-Ready/15/im/win-polyfill/build/i686-pc-windows-msvc-14-debug/CMakeFiles/CMakeOutput.log".
[cmake] See also "E:/CI-Cor-Ready/15/im/win-polyfill/build/i686-pc-windows-msvc-14-debug/CMakeFiles/CMakeError.log".
May patch didn't fixed this issue, I need submit a fix
This issue is now marked as 'stale-old' due to there being no activity on it for the past 720 days. Unless the 'stale-old' label is removed or the issue is commented on, this will be remain open for at least 14 days and then it may be closed. If you would like to make this issue exempt from getting stale, please add the 'stale-exempt' label.
According to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat We can specify options for vs2015 or vs 2017
So we can detecting vs2015 proplery