Best practice for c++20 modules?

Hi,

Using CMake 3.27+ and clang 16/17+ (or gcc 13.2+), what would be the best way to have a project B import a module generated in a project A, out of tree ?

I am on Linux.
Many examples out there are not out-of-tree.

–Global dev dir
-----Project A
—build
—src
—includes
—CMakeLists.txt

-----Project B
—build
—src
—includes
—CMakeLists.txt

-----Project C
—build
—src
—includes
—CMakeLists.txt

Projects are independent but Project A is a module, project B and C ae executables.

Right now, Project A is a static library imported in B and C. Works perfectly fine as is.
But I am willing to test.

More globally, having a best practice thread, evolving with the implementations, would be phenomenal.

Thanks

Experimental support for IMPORTED targets with modules just landed yesterday if you want to test out master. Note that there aren’t “best practices” yet, but testing that things work as intended with “real” code would be appreciated.

I have a lot of interest for it so I will do.
I have a medium multi libs project that is waiting for it. :slightly_smiling_face: