Following is an extract of a typical cmake directory layout (I enclose directories in square brackets):
- [libxxx] - CMakeLists.txt - [include] - CMakeLists.txt - [libxxx] - xxx.h - [src] - CMakeLists.txt - xxx.cpp - [tests] - CMakeLists.txt - mytest.cpp
Personally I prefer many small projects instead of big ones and for that case the preferred build2 directory layout (build2 is the build system from Boris Kolpackov) seems more reasonable to me. The cmake analogy of the build2 layout would be:
- [libxxx] - CMakeLists.txt - [libxxx] - CMakeLists.txt - xxx.h - xxx.cpp - [tests] - CMakeLists.txt - mytest.cpp
The reasoning for the canonical build2 layout is defended here. Furthermore, here the same layout is suggested as standard layout for any c++ project and in particular for projects switching to modules. The second link is to the end of the document where the acknowledgements are listed to show that this layout has actually been reviewed and is not just a personal opinion of some tool writer.
This layout merges
include directories into a single
projectname directory and if there are only few files in each project, then I see the advantage of reduced verbosity and flatter hierarchies.
Finally, when modules become mainstream, then the argument may lean even more towards merging
src into a single directory.
Any reason not to follow the build2 layout recommendation with cmake projects?