Skip to content

[vcpkg] CMAKE_C_COMPILER and CMAKE_CXX_COMPILER are not set #13294

@JackBoosY

Description

@JackBoosY

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.

Metadata

Metadata

Labels

category:vcpkg-bugThe issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions