This repository has some modules for the CMake build system. Each module is stand-alone, so you can copy any file of interest directly into your project and use it like any other CMake module.
The modules are in the top-level subdirectory called cmake.
| Module | Description |
|---|---|
disable_in_source_builds |
A classic that enforces best practices and prevents any in-source builds. |
compiler_init |
Sets several commonly used compiler flags, particularly warning flags. |
doxytest |
Extracts tests from header file comments and creates targets for each resulting test file (uses the doxytest.py script). |
add_executables |
Adds targets for lots of small one-file executables. |
add_archive |
Adds a target to create an archive of some files/directories. |
fetch_content |
A small wrapper around the standard CMake module FetchContent. |
systematize |
Treat the header files for an imported library as “system” includes. |
The modules are stand-alone, so you can copy any of interest directly into your project and use it like any other CMake module (the doxytest module needs to be paired with the doxytest.py script in the same directory). By convention, one puts modules like these in a top-level subdirectory called cmake.
However you get the modules, you use them by letting CMake know where they are, including the particular ones of interest, and invoking the corresponding function.
For example, if you have copied the files into a top-level subdirectory cmake, then your CMakeLists.txt file might include some lines like:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(disable_in_source_builds)
disable_in_source_builds()You can read the project's documentation. We used the static website generator Quarto to construct the documentation site.
You can contact me by email.
Copyright (c) 2022-present Nessan Fitzmaurice.
You can use this software under the MIT license.