Hi All,
We have a question, why does CMake call x64/x86/cl.exe instead of x86/x86/cl.exe when we have clean cmd set to VS x86_x86 command prompt and generator set to MSVC? But setting the generator to Ninja it calls x86/x86/cl.exe? We know that “-Thost” can specify the host architecture, but we want to confirm if this is by design?
Repro(for example):
- open a clean cmd
- “C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat” -host_arch=x86 -arch=x86
- git clone GitHub - abseil/abseil-cpp: Abseil Common Libraries (C++) f:\abseil-cpp
- mkdir f:\abseil-cpp\build_x86_msvc & cd f:\abseil-cpp\build_x86_msvc
- cmake -G “Visual Studio 16 2019” -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DABSL_USE_GOOGLETEST_HEAD=ON …
- msbuild /m /p:Platform=Win32 /p:Configuration=Release absl.sln /t:Rebuild > build.log
- mkdir f:\abseil-cpp\build_x86_Ninja & cd f:\abseil-cpp\build_x86_Ninja
- cmake -G Ninja -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DABSL_USE_GOOGLETEST_HEAD=ON .
- cmake --build . --config Release --verbose > build.log
Log(MSVC):
f:\abseil-cpp\build_x86_msvc>cmake.exe -G “Visual Studio 16 2019” -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DABSL_USE_GOOGLETEST_HEAD=ON …
– The CXX compiler identification is MSVC 19.29.30146.0
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x86/cl.exe - skipped
– Detecting CXX compile features
Log(Ninja):
f:\abseil-cpp\build_x86_Ninja>cmake.exe -G Ninja -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DABSL_USE_GOOGLETEST_HEAD=ON …
– The CXX compiler identification is MSVC 19.34.31823.3
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Preview/VC/Tools/MSVC/14.34.31823/bin/Hostx86/x86/cl.exe - skipped
– Detecting CXX compile features