conan-io / conan

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

[question] Building with libstdc++ in a non-standard location #16024

Open ChrisKing4 opened 7 months ago

ChrisKing4 commented 7 months ago

What is your question?

The way our machines are set up at my company the compilers and libraries in the standard locations are pretty ancient. More recent versions of the compilers and associated libraries are installed in custom directory. I can get conan2 build to use the compilers by using the tools.build:compiler_executables config option in myprofile. However, it still finds that libstdc++ in the standard location. Is there a way around that?

Have you read the CONTRIBUTING guide?

memsharded commented 7 months ago

Hi @ChrisKing4

Thanks for your question.

I can get conan2 build to use the compilers by using the tools.build:compiler_executables config option in myprofile. However, it still finds that libstdc++ in the standard location. Is there a way around that?

There is no specific tool for this at the moment, but there might be different approaches for this depending on the context:

ChrisKing4 commented 7 months ago

I am using CMake. Without Conan I think I would set RPATH in Cmake. Though to tell you the truth, I mostly build plugins that are run inside another app so I don't specify which C++ lib to use. I am picking up Conan because I want to build a standalone environment for testing out some ideas.

memsharded commented 7 months ago

If it is for CMake, you can inject any arbitrary CMake variable or definition in toolchain files that are injected into the packages build. Please have a look to this example: https://docs.conan.io/2/examples/tools/cmake/cmake_toolchain/inject_cmake_variables.html

Maybe this is good to solve your issue?

ChrisKing4 commented 7 months ago

I'll give that a shot and get back to you.

Thanks, Chris