Always use specific toolchain (profile agnostic) to build the app

234 Views Asked by At

I want my conan build . to always use a certain toolchain, say clang++14 and cmake 3.20 to build itself and its dependencies. How can I accomplish that?

The reason is that our company uses either Ubuntu or Mac machines which default to different conan profiles and we want to streamline this process, also for upgrading C++ standards company wide.

EDIT: Either clang or gcc are installed by default on mac / ubuntu respectively, so the setup would have to make sure to install clang with its build dependencies. Can this also be done?

1

There are 1 best solutions below

7
uilianries On

You can always provide custom profiles, not only specific settings, but also with config.

For instance I could have a profile for Apple Clang, that uses CMake + Ninja always:

[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=17
compiler.libcxx=libc++
compiler.version=14
os=Macos
[tool_requires]
*:cmake/3.20@
[conf]
*:tools.cmake.cmaketoolchain:generator=Ninja

Now you could store your profiles in a git repository, and use conan config install command to install those profiles in your Conan home folder. With this mechanism, you can distribute your profiles in your company, plus, your co-workers can collaborate too.