Conan 1.X and CMake disagree on toolchain

83 Views Asked by At

I have a C++ project that has some 3rd party dependencies that I build on the fly using

cd build
conan install .. --build=missing
cmake ..

However the last command produces this error:

CMake Error at conan_output/conanbuildinfo.cmake:692 (message):
  Incorrect 'clang', is not the one detected by CMake: 'GNU'
Call Stack (most recent call first):
  conan_output/conanbuildinfo.cmake:249 (conan_check_compiler)
  CMakeLists.txt:7 (conan_basic_setup)

It seems conanbuildinfo checks if the compiler is actually clang but cmake wants to configure using GNU(?).

I've already discussed a similar issue in another thread whereas the outcome was to just nudge cmake to use the toolchain specified by the CC and CXX environmental variables in my default conan profile. However, now not even that works! Here's my default conan profile:

conan profile show default

Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=14
compiler.libcxx=libstdc++11
build_type=Release
[options]
[conf]
[build_requires]
[env]
CC=/usr/bin/clang
CXX=/usr/bin/clang++

It seems to have no effect on cmake though! How can I issue cmake to use the same compiler as conan used to build the dependencies?

0

There are 0 best solutions below