In vcpkg-configure-cmake, we doesn't set CMAKE_C_COMPILER or CMAKE_CXX_COMPILER, causes cmake to automatically acquire the compiler.
After llvm built clang++, when we set up and used ninja or Visual Studio, cmake obtained and detected clang++, which caused some parameters (such as /nologo /DWIN32 /D_WINDOWS) we set to destroy the detection process.
Example error:
CMake Error at D:/downloads/tools/cmake-3.18.2-windows/cmake-3.18.2-win32-x86/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"D:/installed/x64-windows/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: D:/buildtrees/ignition-msgs1/x64-windows-rel/CMakeFiles/CMakeTmp
Run Build Command(s):D:/downloads/tools/ninja/1.10.0-windows/ninja.exe cmTC_f8bc8 && [1/2] Building C object CMakeFiles/cmTC_f8bc8.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_f8bc8.dir/testCCompiler.c.obj
D:\installed\x64-windows\bin\clang.exe /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /MP -g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -MD -MT CMakeFiles/cmTC_f8bc8.dir/testCCompiler.c.obj -MF CMakeFiles\cmTC_f8bc8.dir\testCCompiler.c.obj.d -o CMakeFiles/cmTC_f8bc8.dir/testCCompiler.c.obj -c testCCompiler.c
clang: error: no such file or directory: '/nologo'
clang: error: no such file or directory: '/DWIN32'
clang: error: no such file or directory: '/D_WINDOWS'
clang: error: no such file or directory: '/W3'
clang: error: no such file or directory: '/utf-8'
clang: error: no such file or directory: '/MP'
ninja: build stopped: subcommand failed.
In
vcpkg-configure-cmake, we doesn't setCMAKE_C_COMPILERorCMAKE_CXX_COMPILER, causes cmake to automatically acquire the compiler.After llvm built clang++, when we set up and used
ninjaorVisual Studio, cmake obtained and detectedclang++, which caused some parameters (such as /nologo /DWIN32 /D_WINDOWS) we set to destroy the detection process.Example error: