I have created four example projects for demonstrating several aspects of import/export with cmake. Description is here: https://habla.news/u/purplekarrot.net/cmake-import-export
Most beman libraries are header only, but you may find some information useful nevertheless.
Definitely a few interesting points there:
Note that Qux does not set any value that begins with CMAKE_
. Those variables are not meant to be set by projects. Setting them as cache variables would leak into the parent project, while setting them as non-cache variables would prevent injection from the parent project or from the packager.
This seems to be a fundamental point about cmake usage that is never been communicated clearly – although even clear communication about cmake has been obsoleted so it’s difficult to follow best practices. For Beman this should probably be in our guidelines.
Consider a C++ library that requires C++23 internally, but it has a C API, so C++23 is not a usage requirement.
I don’t think there’s anything in c++23 that would be abi incompatible with earlier versions – maybe contracts leaks in for 26, but I’m not even sure on that.