Closed aminya closed 2 years ago
OK. I found multiple issues in the code. Mainly, passing VSVersion Range to vswhere
although it is optional. I am using VS 2022, which is not in [16.0, 17.0). When -latest
is passed, vswhere
is smart enough to find the latest toolchain. So specifying it manually as the default results in this bug.
Now, the error has changed to:
-- Running vcpkg install - done
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/ProjectOptions/test/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_13ed8 && [1/2] Building CXX object CMakeFiles\cmTC_13ed8.dir\Debug\testCXXCompiler.cxx.obj
[2/2] Linking CXX executable Debug\cmTC_13ed8.exe
FAILED: Debug/cmTC_13ed8.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_13ed8.dir\Debug --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_13ed8.dir\Debug\testCXXCompiler.cxx.obj /out:Debug\cmTC_13ed8.exe /implib:Debug\cmTC_13ed8.lib /pdb:Debug\cmTC_13ed8.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 C:\ProjectOptionstest\build\CMakeFiles\CMakeTmp && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Users/aminy/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/ProjectOptions/test/build/CMakeFiles/CMakeTmp/Debug/cmTC_13ed8.exe -installedDir C:/Users/aminy/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
RC Pass 1: command "rc /fo CMakeFiles\cmTC_13ed8.dir\Debug/manifest.res CMakeFiles\cmTC_13ed8.dir\Debug/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:16 (project)
-- Configuring incomplete, errors occurred!
See also "C:/ProjectOptions/test/build/CMakeFiles/CMakeOutput.log".
See also "C:/ProjectOptions/test/build/CMakeFiles/CMakeError.log".
Mainly, passing VSVersion Range to vswhere although it is optional. I am using VS 2022, which is not in [16.0, 17.0). When -latest is passed, vswhere is smart enough to find the latest toolchain. So specifying it manually as the default results in this bug.
I was wanting to have a limited default, just to avoid it being used in 'unsupported' scenarios. I'd be fine with changing the default to [16.0,)
, just so that versions less-than 16 aren't considered
I was under the impression that -latest
limited the results to a single, highest version of the 'matched' set. So I think using -latest
is still the right thing to do to make sure that - if there are multiple matches - the highest matched version is selected by the toolchain file.
Can you please make the error level configurable? I prefer that the build proceeded even if this toolchain fails.
I'm not sure what value there is in proceeding - the point of the toolchain is to find msvc. And if msvc can't be found, then that seems fatal.
Resolved with #5.
I am trying to use this toolchain to find MSVC in ProjectOptions, but when I try to use it, it fails with the following error.
Here is how I use it
Also, I had another concern. Can you please make the error level configurable? I prefer that the build proceeded even if this toolchain fails. CMake may be able to find MSVC later by other means.