conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.31k stars 986 forks source link

Can't build with a compiler in a non-standard location #16047

Open ChrisKing4 opened 7 months ago

ChrisKing4 commented 7 months ago

I am building c++ code on centos7. The way are machines are set up in our facility is that /usr/bin/c++ is installed when the machine is first imaged. Newer compilers and standard libraries are put in a different location. We often have several versions of compilers installed.

I am trying to use the profile configuration: [settings] compiler.cppstd=17 tools.build:compiler_executables={'cpp': '/local/my_selected_toolset/gcc/9.3.1/bin/g++'}

Rather than using the compiler that I specified to check if they support the standard, conan uses /usr/bin/c++.

CMake Error at /net/ent-prod.nfs.laika.com/ifs/laika/depts/prod_tech/dev-tools/linux/cmake-3.28.0-linux-x86_64/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:49 (try_compile): Failed to generate test project build system. Call Stack (most recent call first): CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

jcar87 commented 7 months ago

Moving this to the conan repository -

Hi @ChrisKing4 - thanks for reporting this issue. Would you be able to inspect the contents of conan_toolchain.cmake?

In the profile, tools.build:compiler_executables={'cpp': '/local/my_selected_toolset/gcc/9.3.1/bin/g++'} should cause CMAKE_CXX_COMPILER to be defined in the toolchain file.

On the other hand, any chance the profile is incomplete?