Conan doesn’t drive the build, it does however provide the artifacts needed for the build, which includes an sdk and toolchain binaries such as clang, libc++, compiler buitlins etc. These are versioned and under source control just like any other package that conan provides. It does this by means of a toolchain package, described here. As cmake does not initially know where in the conan cache the compiler will be, the conan package generates a toolchain file containing the correct paths.
As long as the developer uses the typical two-stage conan developer flow:
conan install ...
cmake --preset ...
Then this works fine.
However, developers have to be reminded to run conan install whenever the dependencies or the toolchain needs to be updated.
What I’d really prefer, is for developers to be able to run a one-shot command, for example
$ cmake --preset raspberry-pi
Which would leverage cmake-conan to automatically update the dependencies when required, possibly downloading and installing a toolchain, and configure the project.
Unfortunately I can’t do this (although I haven’t tried Ben’s suggestion yet) because the first thing CMake does is load a toolchain file, and of course conan hasn’t generated it yet.
From the history of CMAKE_PROJECT_TOP_LEVEL_INCLUDES, it does seem that this workflow was considered at one point, and I was wondering if it’s still feasible (obviously not currently, but maybe with some changes that won’t break existing workflows) :
Dedicated Provider Injection Point
…This needs to happen early enough to support what some dependency providers may want to do, but not so early that some important things are not defined yet. Some providers want to control the toolchain details, potentially setting or overriding the CMAKE_TOOLCHAIN_FILE, which means they need a point before the first project() call starts doing things.