defacto directory standard for add_subdirectory

What do you guys think of cmake and other build systems to support a defacto directory standard like

./lib - for compiled .a .so files
./modules/<compiler_id> for compiled modules using new c++ modules
./include for the include
./src for source code to compile
./bin for binary files
library.json - some dependency information yet to be determined. Probably not good in first iteration of a defacto standard for this.

and if anything follows this format add_subdirectory to just automatically generate a CMakeLists.txt for you. It will take all build systems to agree. Most projects don’t follow this, but it will benefit new projects to structure their source code this way. Many projects simple compiling is enough and for such cases such a simple layout will be enough. I understand there is c++ modules coming soon, but it won’t solve all the issues and still require compiling a module for each compiler.

There are other projects also working on this (evoke is meant to be a zero-configuration C++ build system). I think it’s too early to assume how modules will end up working in practice since how modules work in each compiler is different anyways (not just the BMI format, but how/when they get generated and how strict flag matching ends up being).

In any case, there are many use cases not handled here (plugins for applications or Python modules), frameworks, other generated sources (e.g., protobuf). These cases aren’t too uncommon and they either need to be explicitly “sorry, you’re on your own” or at least considered how support would happen.

1 Like