Bootstrap Templates

CMakeTest tests cannot be executed directly by CTest but instead require a bootstrap file to setup the CMakeTest runtime. These bootstrap files are configured at build time. The template these files are configured from is cmake_test/templates/lists.txt. The file is listed below for convenience.

The variables that are inserted into the template are as follows:

  • _ct_min_cmake_version: The minimum version of CMake required by CMakeTest. This variable is generally set by CMakeTest’s CMakeLists.txt

  • _ad_test_file: The file that contains the tests that this template bootstraps. This variable is generally set by ct_add_dir.

  • CMAKETEST_USE_COLORS: The option for whether to use colors that is propagated to the test. This variable is an option initially set by the cmake_test/colors module but can be changed at configure time by the user.

  • CMAKEPP_LANG_DEBUG_MODE: The option for whether CMakePPLang should run in debug mode. This option is treated specially because CMakeTest uses CMakePPLang internally, and enabling debug mode while running tests significantly impacts performance.

  • CT_PRINT_LENGTH: The variable for the print length of pass/fail lines when not overridden by the test. This variable is only set if the user overrides the default of 80 via the ct_set_print_length function or if the PRINT_LENGTH option is passed to ct_add_test or ct_add_section functions.

  • CMAKE_MODULE_PATH: This is the same module path list as used in normal CMake code, it is propagated down to prevent any module not found errors.

CMakeTest uses a second bootstrap file specifically for executing EXPECTFAIL tests in a subprocess. These files are configured at test time from the cmake_test/templates/expectfail.txt template. The file is listed below for convenience.

The variables that are inserted into the template are as follows:

  • _ct_min_cmake_version: The minimum version of CMake required by CMakeTest. This variable is generally set by CMakeTest’s CMakeLists.txt.

  • ct_debug_mode: Whether CMakeTest itself should be debugged. This variable is stored in a CMakePP global called CT_DEBUG_MODE`, and is by default set to the value of ``CMAKEPP_LANG_DEBUG_MODE upon inclusion of cmake_test/cmake_test at configure time.

  • CMAKETEST_USE_COLORS: The option for whether to use colors that is propagated to the test. This variable is an option initially set by the cmake_test/colors module but can be changed at configure time by the user.

  • CT_PRINT_LENGTH: The variable for the print length of pass/fail lines when not overridden by the test. This variable is only set if the user overrides the default of 80 via the ct_set_print_length function or if the PRINT_LENGTH option is passed to ct_add_test or ct_add_section functions.

  • CMAKE_MODULE_PATH: This is the same module path list as used in normal CMake code, it is propagated down to prevent any module not found errors.

  • _es_section_file: The containing file of the section.

  • _es_section_id_defines: A string containing CMake code that sets variables for test and section names to their current IDs. This determines which tests and sections are executed, as only units with a defined ID are executed when CT_EXEC_EXPECTFAIL is true.