CMake module¶
Listfiles located in directories specified by
CMAKE_MODULE_PATH
and having extension .cmake called modules. They can be loaded by
include command. Unlike add_subdirectory command
include(<modulename>) doesn’t create new node in a source/binary tree
hierarchies and doesn’t introduce new scope for variables.
Note
In general by include you can load file with any name, not only
*.cmake. For example:
include(some/file/abc.tt) # file with extension '.tt'
include(another/file/XYZ) # file without extension
Or even CMakeLists.txt:
include(foo/bar/CMakeLists.txt)
Though it is confusing, doesn’t make sense and should be avoided.