CMake Build Files Structure

The correct format is automatically enforced by the pre_commit utility.

  1. Inside src directories, there is one CMakeLists.txt per directory that:

    • adds the contents of that directory to the build.

    • adds subdirectories to the build.

    • it does not add files from subdirectories.

  2. Each CMakeLists.txt has this format:

    • One empty line between logical blocks and one at the end.

    • 4 spaces indentation for code blocks.

    • 8 spaces indentation inside commands.

    • Files and directories sorted alphabetically.