cmake_test/add_dir
- cmake_test/add_dir.ct_add_dir(test_dir **kwargs)
This function will find all
*.cmake
files in the specified directory as well as recursively through all subdirectories. It will then configure the boilerplate template to include() each cmake file and register each configured boilerplate with CTest. The configured templates will be executed seperately via CTest during the Test phase, and each *.cmake file found in the specified directory is assumed to contain CMakeTest tests.- Parameters:
test_dir (path) – The directory to search for *.cmake files containing tests. Subdirectories will be recursively searched.
Keyword Arguments
- Parameters:
CT_DEBUG_MODE_ON (bool) – Enables debug mode when the tests are run.
USE_REL_PATH_NAMES (bool) – Enables using shorter, relative paths for test names, but increases the chance of name collisions.
LABEL (bool) – Use relative directory name for CTest label for all the tests in the directory. In a group of labeled tests with ctest -L <label>
LABEL_NAME (str) – CTest label for all the tests in the directory. Run a group of labeled tests with ctest -L <label>. This argument has higher priority than LABEL
CMAKE_OPTIONS (list) – List of additional CMake options to be passed to all test invocations. Options should follow the syntax:
-D<variable_name>=<value>
LANGUAGES (list) – List of coding languages to set in the project() <https://cmake.org/cmake/help/latest/command/project.html> command. The list will be forwarded to all tests in the directory. If the user does not want all tests to use the same language set, they can set this keyword to
NONE
and then call enable_language() <https://cmake.org/cmake/help/latest/command/enable_language.html> as appropriate on a test-by-test basis. For convenience, the user may set theLANGUAGES
keyword toFORWARD_LANGUAGES
and the tests will use the languages enabled whenct_add_dir
is called. IfLANGUAGES
is not specified only theC
language will be enabled (this is done to silence warnings about not specifying a language).