posting here to present a project I’ve started last week and which may be of interest to CMake userbase, called cninja.
It is a concatenative configuration / toolchain file generator for CMake and tries to solve the problem of CMakeLists.txt becoming complex, bloated and out-of-date over time with various flags and options duplicated across projects to toggle LTO, sanitizers, etc.
It also tries to enforce faster defaults for a better developer experience, by using clang, lld and ninja by default (hence the name). And finally tries to uniformise the semantics so that they are as close as possible on Mac / Windows / Linux to make cross-platform development easier. For instance, symbols will be hidden by default, as it is always a PITA to develop a library on linux only to remember than 500 functions have to be annotated WITH_SOME_EXPORT_MACRO when someone finally asks for a windows build.
To give an usage example, in a given source dir:
cninja asan ubsan debugsyms -- -DCMAKE_PREFIX_PATH=foo/bar
will create a build with debug symbols and pass everything after – to CMake.
cmake --build will be run automatically.
Option sets can also be stored in “.cninja” folders, both in the HOME directory, and in project source dirs.
The project is still very experimental and likely broken left and right, but I could already use it to build many of my own projects.
Usage is documented on the github page, builds are provided for mac / win / linux. I’d be happy to get any input, positive or negative !