Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 2.32 KB

cmake.rst

File metadata and controls

64 lines (47 loc) · 2.32 KB

CMake

Maud generates a CMakeLists.txt which is simple enough to be in .gitignore (but you can also modify it/check it in if you like). The generated CMakeLists.txt is packed with features, including automatic discovery of your source files and inferrence of targets and linkage from their contents.

Auto-inclusion

Whenever explicit configuration is necessary, .cmake modules may be included anywhere in the source tree- close to the portion of the project they affect. .cmake modules are detected and automatically included by CMakeLists.txt. These might be used to:

Auto-included modules have access to:

${MAUD_DIR}
(aka ${CMAKE_BINARY_DIR}/_maud) a directory into which maud-specific build files will be written.
:ref:`glob() <glob-function>`
which produces a list of matching files.
${dir}
the directory containing the current auto-included cmake module (a convenience alias for ${CMAKE_CURRENT_LIST_DIR})
:ref:`option() <option-function>`
which extends cmake's built-in build option declarations.
string_escape()
escapes a string for inclusion in C or json.

cmake_modules directories

.cmake modules for which greater control of inclusion is required can be placed in directories named cmake_modules. Any cmake_modules directories will be added to :cmake:`CMAKE_MODULE_PATH <variable/CMAKE_MODULE_PATH.html>` and their contents will be available for explicit inclusion, including by auto-included modules. These directories might contain:

Use of :cmake:`include_guard() <command/include_guard.html>` is strongly recommended to ensure that explicitly included modules are only included once.