41 KiB
TriBITS Detailed Reference Documentation
The following subsections contain detailed reference documentation for the various TriBITS variables, functions, and macros that are used by TriBITS projects that TriBITS Project Developers need to know about. Variables, functions and macros that are used only internally in TriBITS are generally not documented here (see the TriBITS *.cmake
source files).
TriBITS Global Project Settings
TriBITS defines a number of global project-level settings that can be set by the user and can have their default determined by each individual TriBITS project. If a given TriBITS project does not define its own default, a reasonable default is set by the TriBITS system automatically. These options are defined and are set, for the most part, in the internal TriBITS function tribits_define_global_options_and_define_extra_repos()
in the TriBITS CMake code file TribitsGlobalMacros.cmake
which gets called inside of the tribits_project() macro. That function and that file are the definitive source the options that a TriBITS project takes and what the default values are but we strive to document them here as well. Many of these global options (i.e. cache variables) such as ${PROJECT_NAME}_<SOME_OPTION>
allow the project to define a default by setting a local variable ${PROJECT_NAME}_<SOME_OPTION>_DEFAULT
as:
set(${PROJECT_NAME}_<SOME_OPTION>_DEFAULT <someDefault>)
either in its top-level CMakeLists.txt
file or in its ProjectName.cmake
file (depends on what variable it is as to where it should be set). If ${PROJECT_NAME}_<SOME_OPTION>_DEFAULT
is not set by the project, then TriBITS provides a reasonable default value. The TriBITS code that uses these defaults for this looks like:
if ("${${PROJECT_NAME}_<SOME_OPTION>_DEFAULT}" STREQUAL "")
set(${PROJECT_NAME}_<SOME_OPTION>_DEFAULT <someDefault>)
endif()
advanced_set( ${PROJECT_NAME}_<SOME_OPTION>
${PROJECT_NAME}_<SOME_OPTION>_DEFAULT}
CACHE BOOL "[documentation]."
)
where <SOME_OPTION>
is an option name, for example like TEST_CATEGORIES
, and <someDefault>
is the default set by TriBITS if the project does not define a default. In this way, if the project sets the variable ${PROJECT_NAME}_<SOME_OPTION>_DEFAULT
before this code executes, then ${${PROJECT_NAME}_<SOME_OPTION>_DEFAULT}
will be used as the default for the cache variable ${PROJECT_NAME}_<SOME_OPTION>
which, of course, can be overridden by the user when calling cmake
in a number of ways.
Most of these global options that can be overridden externally by setting the cache variable ${PROJECT_NAME}_<SOME_OPTION>
should be documented in the Project-Specific Build Reference document. A generic version of this document is found in TribitsBuildReference. Some of the more unusual options that might only be of interest to developers mentioned below may not be documented in TribitsBuildReference.
The global project-level TriBITS options for which defaults can be provided by a given TriBITS project are:
- ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE
- ${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES
- ${PROJECT_NAME}_C_Standard
- ${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS
- ${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND
- ${PROJECT_NAME}_CPACK_SOURCE_GENERATOR
- ${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE
- ${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES
- ${PROJECT_NAME}_ELEVATE_ST_TO_PT
- ${PROJECT_NAME}_ENABLE_CPACK_PACKAGING
- ${PROJECT_NAME}_ENABLE_CXX
- ${PROJECT_NAME}_ENABLE_C
- ${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
- ${PROJECT_NAME}_ENABLE_Fortran
- ${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES
- ${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE
- ${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION
- ${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES
- ${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES
- ${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE
- ${PROJECT_NAME}_IMPORTED_NO_SYSTEM
- ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS
- ${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE
- ${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE
- ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE
- ${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS
- ${PROJECT_NAME}_REQUIRES_PYTHON
- ${PROJECT_NAME}_SET_INSTALL_RPATH
- ${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME
- ${PROJECT_NAME}_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES
- ${PROJECT_NAME}_TEST_CATEGORIES
- ${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS
- ${PROJECT_NAME}_TRACE_ADD_TEST
- ${PROJECT_NAME}_USE_GNUINSTALLDIRS
- ${PROJECT_NAME}_USES_PYTHON
- DART_TESTING_TIMEOUT
- CMAKE_INSTALL_RPATH_USE_LINK_PATH
- MPI_EXEC_MAX_NUMPROCS
- PythonInterp_FIND_VERSION
- TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE
These options are described below.
${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE
The CMake cache variable
${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE
is used to define how some invalid TriBITS usage checks are handled. The valid values include 'FATAL_ERROR', 'SEND_ERROR', 'WARNING', and 'IGNORE'. The default value is 'FATAL_ERROR' for a project when${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE=ON
, which is best for development mode for a project that currently has no invalid usage patterns. The default is 'IGNORE' when${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE=OFF
. But a project with some existing invalid usage patterns might want to set, for example, a default of 'WARNING' in order to allow for a smooth upgrade of TriBITS. To do so, set:set(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE_DEFAULT WARNING)
in the project's base <projectDir>/ProjectName.cmake file.
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES
To set
${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES
a different default, set:set(${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES_DEFAULT <newDefault>)
in the project's base <projectDir>/ProjectName.cmake file, where
<newDefault>
can beFATAL_ERROR
,SEND_ERROR
,WARNING
,NOTICE
orIGNORE
Otherwise, the default is
WARNING
when${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
isON
and ifIGNORE
if${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
isOFF
.
${PROJECT_NAME}_C_Standard
The variable
${PROJECT_NAME}_C_Standard
is used define the C standard pass to the compiler in--std=<cstd>
for GCC builds of the project. TriBITS sets the default asc99
but the project can set a new default in the project's base <projectDir>/CMakeLists.txt file with, for example:set(${PROJECT_NAME}_C_Standard_DEFAULT c11)
${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS
The variable
${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS
determines how unparsed and otherwise ignored arguments are handled in TriBITS functions that are called by the client TriBITS projects. These are arguments that are left over from parsing input options to functions and macros that take both positional arguments and keyword arguments/options handled with thecmake_parse_arguments()
function. For example, for the a TriBITS function declared like:tribits_copy_files_to_binary_dir( <targetName> [SOURCE_FILES <file1> <file2> ...] [SOURCE_DIR <sourceDir>] ... )
the arguments
SOURCE_FILES <file1> <file2> ...
and those that follow are parsed by thecmake_parse_arguments()
function while the argument<targetName>
is a positional argument. The problem is that any arguments passed between the first<targetName>
argument and the specified keyword arguments likeSOURCE_FILES
andSOURCE_DIR
are returned as unparsed arguments and are basically ignored (which is what happened in earlier versions of TriBITS). For example, calling the function as:tribits_copy_files_to_binary_dir( FooTestCopyFiles ThisArgumentIsNotParsedAndIsIgnored SOURCE_FILES file1.cpp file2.cpp ... ... )
would result in the unparsed argument
ThisArgumentIsNotParsedAndIsIgnored
.The value of
${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS
determines how that ignored argument is handled. If the value isWARNING
, then it will just result in amessage(WARNING ...)
command that states the warning but configure is allowed to be completed. This would be the right value to allow an old TriBITS project to keep configuring until the warnings can be cleaned up. If the value isSEND_ERROR
, thenmessage(SEND_ERROR ...)
is called. This will result in the configure failing but will allow configure to continue until the end (or aFATAL_ERROR
is raised). This would be the right value when trying to upgrade a TriBITS project where you wanted to see all of the warnings when upgrading TriBITS (so you could fix them all in one shot). Finally, the value ofFATAL_ERROR
will result inmessage(FATAL_ERROR ...)
being called which will halt configure right away. This is the best value when developing on a TriBITS project that is already clean but you want to catch new developer-inserted errors right away.The default value for
${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS
isWARNING
, so that it will be backward compatible for TriBITS projects that might have previously undetected unparased and therefore ignored argument . However, a project can change the default by setting, for example:set(${PROJECT_NAME}_CHECK_FOR_UNPARSED_ARGUMENTS_DEFAULT FATAL_ERROR)
in the <projectDir>/ProjectName.cmake file.
The user of a TriBITS project should not be able to trigger this unparsed arguments condition so this variable is not documented in the TriBITS Build Reference. But it is still a CMake cache var that is documented in the CMakeCache.txt file and can be set by the user or developer if desired.
${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND
The variable
${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND
is used to define the absolute path to a file (or a list of files) that should be included after the files listed in${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE
. This variable can be used by the TriBITS project to define, for example, a standard set of development environments in the base <projectDir>/CMakeLists.txt file with:set(${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE_APPEND_DEFAULT "${CMAKE_CURRENT_LIST_DIR}/cmake/StdDevEnvs.cmake")
before the tribits_project() command. By including this file(s) after the file(s) listed in
${PROJECT_NAME}_CONFIGURE_OPTIONS_FILE
, the user can override the variables set in this appended file(s). But it is important that these variables best set after the users options have been set but before the Package and TPL dependency analysis is done (because this might enable or disable some TPLs).
${PROJECT_NAME}_CPACK_SOURCE_GENERATOR
The variable
${PROJECT_NAME}_CPACK_SOURCE_GENERATOR
determines the CPack source generation types that are created when thepackage_source
target is run. The TriBITS default is set toTGZ
. However, this default can be overridden by setting, for example:set(${PROJECT_NAME}_CPACK_SOURCE_GENERATOR_DEFAULT "TGZ;TBZ2")
This variable should generally be set in the file:
<projectDir>/cmake/CallbackDefineProjectPackaging.cmake
instead of in the base-level
CMakeLists.txt
file so that it goes along with rest of the project-specific CPack packaging options.
${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE
The variable
${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE
determines if the CTest driver scripts using tribits_ctest_driver() configure, build, test and submit results to CDash all-at-once for all of the packages being tested or if instead is done package-by-package. Currently, the default is set toFALSE
for the package-by-package mode (for historical reasons) but the default can be set toTRUE
by setting:set(${PROJECT_NAME}_CTEST_DO_ALL_AT_ONCE_DEFAULT "TRUE")
in the project's <projectDir>/ProjectName.cmake file. (This default must be changed in the
<projectDir>/ProjectName.cmake
file and NOT the <projectDir>/CMakeLists.txt file because the latter is not directly processed in CTest -S driver scripts usingtribits_ctest_driver()
.)In general, a project should change the default to
TRUE
when using a newer CDash installation with CDash versions 3.0+ that can accommodate the results coming from ctest -S and display them package-by-package very nicely. Otherwise, most projects are better off with package-by-package mode since it results in nicer display on CDash for older CDash versions.
${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES
If ${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=ON (the TriBITS default value), then any explicitly enabled packages that have disabled upstream required packages or TPLs will be disabled. If ${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES=OFF, then an configure error will occur. For more details also see TribitsBuildReference and Disables trump enables where there is a conflict. A project can define a different default value by setting:
set(${PROJECT_NAME}_DISABLE_ENABLED_FORWARD_DEP_PACKAGES_DEFAULT FALSE)
${PROJECT_NAME}_ELEVATE_ST_TO_PT
If
${PROJECT_NAME}_ELEVATE_ST_TO_PT
is set toON
, then allST
packages will be elevated toPT
packages. The TriBITS default is obviouslyOFF
. The default can be changed by setting:set(${PROJECT_NAME}_ELEVATE_ST_TO_PT_DEFAULT ON)
There are projects, especially meta-projects, where the distinction between
PT
andST
code is not helpful or the assignment ofPT
andST
packages in a repository is not appropriate with respect to the outer meta-project. An example project like this CASL VERA. Changing the default toON
allows any and packages to be considered in pre-push testing.
${PROJECT_NAME}_ENABLE_CPACK_PACKAGING
If
${PROJECT_NAME}_ENABLE_CPACK_PACKAGING
isON
, then CPack support is enabled and some TriBITS code is run that is needed to set up data-structures that are used by the built-in CMake targetpackage_source
. The TriBITS default isOFF
with the idea that the average developer or user will not be wanting to create source distributions with CPack. However, this default can be changed by setting:set(${PROJECT_NAME}_ENABLE_CPACK_PACKAGING_DEFAULT ON)
${PROJECT_NAME}_ENABLE_CXX
If
${PROJECT_NAME}_ENABLE_CXX
isON
, then C++ language support for the project will be enabled and the C++ compiler must be found. By default, TriBITS sets this toON
for all systems. A project never requires C++ can set this to off by default by setting:set(${PROJECT_NAME}_ENABLE_CXX_DEFAULT FALSE)
${PROJECT_NAME}_ENABLE_C
If
${PROJECT_NAME}_ENABLE_C
isON
, then C language support for the project will be enabled and the C compiler must be found. By default, TriBITS sets this toON
for all systems. A project never requires C can set this to off by default by setting:set(${PROJECT_NAME}_ENABLE_C_DEFAULT FALSE)
If a project does not have any native C code a good default would be:
set(${PROJECT_NAME}_ENABLE_C_DEFAULT FALSE)
NOTE: It is usually not a good idea to always force off C, or any compiler, because extra repositories and packages might be added by someone that might require the compiler and we don't want to unnecessarily limit the generality of a given TriBITS build. Setting the default for all platforms should be sufficient.
${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
The variable
${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
switches the TriBITS project from development mode to release mode. The default for this variable${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT
should be set in the project's <projectDir>/Version.cmake file and switched fromON
toOFF
when creating a release (see Project and Repository Versioning and Release Mode). When${PROJECT_NAME}_ENABLE_DEVELOPMENT_MODE
isON
, several other variables are given defaults appropriate for development mode. For example,${PROJECT_NAME}_ASSERT_DEFINED_DEPENDENCIES
is set toFATAL_ERROR
by default in development mode but is set toIGNORE
by default in release mode. In addition, strong compiler warnings are enabled by default in development mode but are disabled by default in release mode. This variable also affects the behavior of tribits_set_st_for_dev_mode().
${PROJECT_NAME}_ENABLE_Fortran
If
${PROJECT_NAME}_ENABLE_Fortran
isON
, then Fortran support for the project will be enabled and the Fortran compiler(s) must be found. By default, TriBITS sets this toON
.If a project does not have any native Fortran code a good default would be:
set(${PROJECT_NAME}_ENABLE_Fortran_DEFAULT OFF)
This default can be set in <projectDir>/ProjectName.cmake or <projectDir>/CMakeLists.txt.
On WIN32 systems, the default for
${PROJECT_NAME}_ENABLE_Fortran_DEFAULT
is set toOFF
since it can be difficult to get a Fortran compiler for native Windows.Given that a native Fortran compiler is not supported by default on Windows and on most Mac OSX systems, projects that have optional Fortran code may decide to set the default depending on the platform by setting, for example:
if ( (WIN32 AND NOT CYGWIN) OR (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") ) message(STATUS "Warning: Setting ${PROJECT_NAME}_ENABLE_Fortran=OFF by default" " because this is Windows (not cygwin) and we assume to not have Fortran!") set(${PROJECT_NAME}_ENABLE_Fortran_DEFAULT OFF) else() set(${PROJECT_NAME}_ENABLE_Fortran_DEFAULT ON) endif()
NOTE: It is usually not a good idea to always force off Fortran, or any compiler, because extra repositories and packages might be added by someone that might require the compiler and we don't want to unnecessarily limit the generality of a given TriBITS build. Setting the default for all platforms should be sufficient.
${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES
If
${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES
is set toON
, then<PackageName>Config.cmake
files are created at configure time in the build tree and installed into the install tree. These files are used by external CMake projects to pull in the list of compilers, compiler options, include directories and libraries. The TriBITS default isOFF
but a project can change the default by setting, for example:set(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT ON)
A project would want to leave off the creation and installation of
<PackageName>Config.cmake
files if it was only installing and providing executables (see ${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS). However, if it is wanting to provide libraries for other projects to use, then it should turn on the default generation of these files.
${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE
If
${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE
isON
, then packages and subpackages marked asST
in the <repoDir>/PackagesList.cmake file will be implicitly enabled along with thePT
packages. Additional code and tests may also be enabled using this option. The TriBITS default isOFF
but this can be changed by setting:set(${PROJECT_NAME}_ENABLE_SECONDARY_TESTED_CODE_DEFAULT ON)
in the <projectDir>/ProjectName.cmake file.
${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION
If
${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION
isTRUE
, then the directories for subpackages that are not enabled are left out of the source tarball. This reduces the size of the tarball as much as possible but does require that the TriBITS packages and subpackages be properly set up to allow disabled subpackages from being excluded. The TriBITS default isTRUE
but this can be changed by setting:set(${PROJECT_NAME}_EXCLUDE_DISABLED_SUBPACKAGES_FROM_DISTRIBUTION_DEFAULT FALSE)
${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES
If
${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES
isON
, then the data-structures needed to generate<PackageName>Config.cmake
files are created. These data structures are also needed in order to generate export makefiles on demand using the function tribits_write_flexible_package_client_export_files(). The default in TriBITS is to turn thisON
automatically by default if${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES
isON
. Else, by default, TriBITS sets this toOFF
. The only reason for the project to override the default is to set it toON
as with:set(${PROJECT_NAME}_GENERATE_EXPORT_FILE_DEPENDENCIES_DEFAULT ON)
is so that the necessary data-structures are generated in order to use the function tribits_write_flexible_package_client_export_files().
${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES
If
${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES
isON
, then the filesVersionDate.cmake
and<RepoName>_version_date.h
will get generated and the generated file<RepoName>_version_date.h
will get installed for each TriBITS version-controlled repository when the local directories are git repositories. The default isOFF
but the project can change that by setting:set(${PROJECT_NAME}_GENERATE_VERSION_DATE_FILES ON)
in the <projectDir>/ProjectName.cmake file.
${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE
If
${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE
isON
, then the file<Project>RepoVersion.txt
will get generated as a byproduct of configuring with CMake. See Multi-Repository Support and <Project>_GENERATE_REPO_VERSION_FILE. The default isOFF
but the project can change that by setting:set(${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT ON)
in the <projectDir>/ProjectName.cmake file.
Note that if a
git
exectauble cannot be found at configure time, then the default${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE_DEFAULT
will be overridden toOFF
. But if the user sets${PROJECT_NAME}_GENERATE_REPO_VERSION_FILE=ON
in the cache andgit
can't be found, then an configure-time error will occur.
${PROJECT_NAME}_IMPORTED_NO_SYSTEM
By default, include directories from IMPORTED library targets from the TriBITS project's installed
<Package>Config.cmake
files will be consideredSYSTEM
headers and therefore be included on the compile lines of downstream CMake projects with-isystem
with most compilers. However, if${PROJECT_NAME}_IMPORTED_NO_SYSTEM
is set toON
(only supported for CMake versions 3.23 or greater), then all of the IMPORTED library targets exported into the set of installed<Package>Config.cmake
files will have theIMPORTED_NO_SYSTEM
property set. This will cause downstream customer CMake projects to apply the include directories from these IMPORTED library targets as non-system include directories. On most compilers, that means that the include directories will be listed on the compile lines with-I
instead of with-isystem
. (See more details in the TriBITS Build Reference for<Project>_IMPORTED_NO_SYSTEM
.)The default value set by TriBITS itself is
OFF
but a TriBITS project can change the default value toON
by adding:if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.23) set(${PROJECT_NAME}_IMPORTED_NO_SYSTEM_DEFAULT ON) endif()
in the <projectDir>/ProjectName.cmake file. (NOTE: The above
if()
statement ensures that a configure error will not occur if a version of CMake less than 3.23 is used. But if the TriBITS project minimum CMake version is 3.23 or greater, then the aboveif()
statement guard can be removed.)
${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS
If
${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS
is set toON
, then any defined libraries or header files that are listed in calls to tribits_add_library() or tribits_install_headers() will be installed (unless options are passed into tribits_add_library() that disable installs). If set toOFF
, then headers and libraries will not be installed by default and onlyINSTALLABLE
executables added with tribits_add_executable() will be installed. However, as described in TribitsBuildReference, shared libraries will always be installed if enabled since they are needed by the installed executables.For a TriBITS project that is primarily delivering libraries (e.g. Trilinos), then it makes sense to leave the TriBITS default which is
ON
or explicitly set:set(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT ON)
For a TriBITS project that is primarily delivering executables (e.g. VERA), then it makes sense to set the default to:
set(${PROJECT_NAME}_INSTALL_LIBRARIES_AND_HEADERS_DEFAULT OFF)
${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE ${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE ${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE
Determines the permissions for directories and files created during the execution of the of the
install
andisntall_package_by_package
targets.To make the created directories by only group readable for the project by default, set:
set(${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE_DEFAULT TRUE)
To make the created directories by only group writable (and readable) for the project by default, set:
set(${PROJECT_NAME}_MAKE_INSTALL_WORLD_WRITABLE_DEFAULT TRUE)
To make the created directories by world readable for the project by default, set:
set(${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE_DEFAULT TRUE)
On non-Windows systems, these set permissions for all files and directories from the the user-set base directory
${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR
on down. For more details see Installation considerations.These defaults can be set in the <projectDir>/ProjectName.cmake file.
${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS
Determines if all of the libraries listed in
<tplName>_LIBRARY_NAMES
for a given TPL must be found for each enabled TPL. By default, this isFALSE
which means that the determination if all of the listed libs for a TPL should be found is determined by theMUST_FIND_ALL_LIBS
option to the tribits_tpl_find_include_dirs_and_libraries() function in the TPL find module. To change the default for this, set:set(${PROJECT_NAME}_MUST_FIND_ALL_TPL_LIBS_DEFAULT TRUE)
in the <projectDir>/ProjectName.cmake file.
${PROJECT_NAME}_REQUIRES_PYTHON
If the TriBITS project requires Python, set:
set(${PROJECT_NAME}_REQUIRES_PYTHON TRUE)
in the <projectDir>/ProjectName.cmake file (See Python Support). The default is implicitly
FALSE
.
${PROJECT_NAME}_SET_INSTALL_RPATH
The cache variable
${PROJECT_NAME}_SET_INSTALL_RPATH
is used to define the default RPATH mode for the TriBITS project (see Setting install RPATH for details). The TriBITS default is to set this toTRUE
but the TriBITS project can be set the default toFALSE
by setting:set(${PROJECT_NAME}_SET_INSTALL_RPATH_DEFAULT FALSE)
in the project's <projectDir>/ProjectName.cmake file (see RPATH Handling).
${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME
The cache variable
${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME
determines if the start and end date/time for each advanced test (i.e. added with tribits_add_advanced_test()) is printed or not with each test. If set toTRUE
this also causes in the timing for eachTEST_<IDX>
block to be printed as well. The TriBITS default isOFF
but a TriBITS project can change this default by setting:set(${PROJECT_NAME}_SHOW_TEST_START_END_DATE_TIME_DEFAULT ON)
The implementation of this feature currently uses
execute_process(date)
and therefore will work on many (but perhaps not all) Linux/Unix/Mac systems and not on Windows systems.NOTE: In a future version of CTest, this option may turn on start and end date/time for regular tests added with tribits_add_test() (which uses a raw command with
add_test()
).
${PROJECT_NAME}_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES
To change the default value of the
${PROJECT_NAME}_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES
toTRUE
, for example, for a TriBITS project, set:set(${PROJECT_NAME}_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES_DEFAULT TRUE)
in the project's <projectDir>/CMakeLists.txt or <projectDir>/ProjectName.cmake files.
${PROJECT_NAME}_SKIP_EXTRAREPOS_FILE
The cache variable
${PROJECT_NAME}_SKIP_EXTRAREPOS_FILE
is set in the <projectDir>/ProjectName.cmake file as:set(${PROJECT_NAME}_SKIP_EXTRAREPOS_FILE TRUE)
for projects that don't have a <projectDir>/cmake/ExtraRepositoriesList.cmake file. This variable needs to be set when using the CTest driver script and does not need to be set for the basic configure and build process.
${PROJECT_NAME}_TEST_CATEGORIES
The cache variable
${PROJECT_NAME}_TEST_CATEGORIES
determines what tests defined using tribits_add_test() and tribits_add_advanced_test() will be added forctest
to run (see Test Test Category). The TriBITS default isNIGHTLY
for a standard local build. The checkin-test.py tool sets this toBASIC
by default. A TriBITS project can override the default for a basic configure using, for example:set(${PROJECT_NAME}_TEST_CATEGORIES_DEFAULT BASIC)
The justification for having the default Test Test Category be
NIGHTLY
instead ofBASIC
is that when someone is enabling a package to develop on it or install it, we want them by default to be seeing the full version of the test suite (shy of the Test Test Category HEAVY tests which can be very expensive) for the packages they are explicitly enabling. Typically they will not be enabling forward/downstream dependent packages so the cost of running the test suite should not be too prohibitive. This all depends on how good of a job the development teams do in making their test suites run fast and keeping the cost of running the tests down. See the section TriBITS Automated Testing for a more detailed discussion.
${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS
If
${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS
is set toTRUE
, then theSYSTEM
flag will be passed into theinclude_directories()
command for TPL include directories for every TPL for every package, by default. On some systems this will result in include directories being passed to the compiler with-isystem
instead of-I
. This helps to avoid compiler warning coming from TPL header files for C and C++. However, with CMake version 3.2 and less, this also results in-isystem
being passed to the Fortran compiler (e.g. gfortran) as well. This breaks the reading of Fortran module files (perhaps a bug in gfortran). Because of this issue with Fortran, the TriBITS default for this option is set toFALSE
but a project can override the default using:set(${PROJECT_NAME}_TPL_SYSTEM_INCLUDE_DIRS_DEFAULT TRUE)
(This would be a good default if the project has not Fortran files or has not Fortran files that use modules provided by TPLs).
However, if a package or subpackage sets:
set(${PACKAGE_NAME}_SKIP_TPL_SYSTEM_INCLUDE_DIRS TRUE)
in its
CMakeLists.txt
files before thetribits_add_library()
ortribits_add_executable()
commands are called in that package, thenSYSTEM
will not be passed intoinclude_directories()
for TPL include dirs. This is how some TriBITS packages with Fortran files that use Fortran modules avoid passing in-isystem
to the Fortran compiles and thereby avoid the defect with gfortran described above. If CMake version 3.3 or greater is used, this variable is not required.NOTE: Currently, a TriBITS package must have a direct dependency on a TPL to have
-isystem
added to a TPL's include directories on the compile lines for that package. That is, the TPL must be listed in theLIB_REQUIRED_TPLS
orLIB_OPTIONAL_TPLS
arguments passed into the tribits_package_define_dependencies() function in the package's <packageDir>/cmake/Dependencies.cmake file. In addition, to have-isystem
added to the include directories for a TPL when compiling the tests for an package, it must be listed in theTEST_REQUIRED_TPLS
orTEST_OPTIONAL_TPLS
arguments. This is a limitation of the TriBITS implementation that will be removed in a future version of TriBITS.
${PROJECT_NAME}_TRACE_ADD_TEST
If
${PROJECT_NAME}_TRACE_ADD_TEST
is set toTRUE
, then a single line will be printed for each call to tribits_add_test() and tribits_add_advanced_test() for if the test is added or not and if not then why. The default is set based on the value of${PROJECT_NAME}_VERBOSE_CONFIGURE
but a project can override the default by setting:set(${PROJECT_NAME}_TRACE_ADD_TEST_DEFAULT TRUE)
${PROJECT_NAME}_USE_GNUINSTALLDIRS
If
${PROJECT_NAME}_USE_GNUINSTALLDIRS
is set toTRUE
, then the default install paths will be determined by the standard CMake moduleGNUInstallDirs
. Otherwise, platform independent install paths are used by default.A project can use the paths given the cmake module
GNUInstallDirs
by default by setting:set(${PROJECT_NAME}_USE_GNUINSTALLDIRS_DEFAULT TRUE)
in the project's top-level <projectDir>/CMakeLists.txt file or its <projectDir>/ProjectName.cmake file. The default is
FALSE
.
${PROJECT_NAME}_USES_PYTHON
If the TriBITS project can use Python, but does not require it, set:
set(${PROJECT_NAME}_USES_PYTHON TRUE)
in the <projectDir>/ProjectName.cmake file (see Python Support). The default for a TriBITS project is implicitly
TRUE
. To explicitly state that Python is never needed, set:set(${PROJECT_NAME}_USES_PYTHON FALSE)
DART_TESTING_TIMEOUT
The cache variable
DART_TESTING_TIMEOUT
is a built-in CMake variable that provides a default timeout for all tests (see Setting test timeouts at configure time). By default, TriBITS defines this to be 1500 seconds (which is also the raw CMake default) but the project can change this default, from 1500 to 300 for example, by setting the following in the project's <projectDir>/ProjectName.cmake or <projectDir>/CMakeLists.txt file:set(DART_TESTING_TIMEOUT_DEFAULT 300)
CMAKE_INSTALL_RPATH_USE_LINK_PATH
The cache variable
CMAKE_INSTALL_RPATH_USE_LINK_PATH
is a built-in CMake variable that determines if the paths for external libraries (i.e. from TPLs) is put into the installed library RPATHS (see RPATH Handling). TriBITS sets the default for this toTRUE
but a project can change the default back toFALSE
by setting the following in the project's <projectDir>/ProjectName.cmake file:set(CMAKE_INSTALL_RPATH_USE_LINK_PATH_DEFAULT FALSE)
MPI_EXEC_MAX_NUMPROCS
The variable
MPI_EXEC_MAX_NUMPROCS
gives the maximum number of processes for an MPI test that will be allowed as defined by tribits_add_test() and tribits_add_advanced_test(). The TriBITS default is set to be4
(for no good reason really but it needs to stay that way for backward compatibility). This default can be changed by setting:set(MPI_EXEC_MAX_NUMPROCS_DEFAULT <newDefaultMax>)
While this default can be changed for the project as a whole on all platforms, it is likely better to change this default on a machine-by-machine basis to correspond to the load that can be accommodated by a given machine (or class of machines). For example if a given machine has 64 cores, a reasonable number for
MPI_EXEC_MAX_NUMPROCS_DEFAULT
is 64.
PythonInterp_FIND_VERSION
Determines the version of Python that is looked for. TriBITS requires at least version "2.7". A particular TriBITS project can require a higher version of TriBITS and this is set using, for example:
set(PythonInterp_FIND_VERSION_DEFAULT "3.5.2")
in the <projectDir>/ProjectName.cmake file (See Python Support). The default is version "2.7". The user can force a more recent version of Python by configuring with, for example:
-D PythonInterp_FIND_VERSION="3.6.2"
TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE
Determines how the function tribits_deprecated() behaves. To change the default behavor, such as call
message(FATAL_ERROR ...)
, set:set(TRIBITS_HANDLE_TRIBITS_DEPRECATED_CODE_DEFAULT FATAL_ERROR)
in the project's <projectDir>/ProjectName.cmake file, or <projectDir>/CMakeLists.txt file, or on the individual package basis in its <packageDir>/CMakeLists.txt file.
TriBITS Macros and Functions
The following subsections give detailed documentation for the CMake macros and functions that make up the core TriBITS system. These are what are used by TriBITS project developers in their CMakeLists.txt
and other files. All of these functions and macros should be automatically available when processing the project's and package's variables files if used properly. Therefore, no explicit include()
statements should be needed other than the initial include of the TriBITS.cmake
file in the top-level <projectDir>/CMakeLists.txt file so the command tribits_project() can be executed.
General Utility Macros and Functions
The following subsections give detailed documentation for some CMake macros and functions which are not a core part of the TriBITS system but are included in the TriBITS source tree, are used inside of the TriBITS system, and are provided as a convenience to TriBITS project developers. One will see many of these functions and macros used throughout the implementation of TriBITS and even in the CMakeLists.txt
files for different projects that use TriBITS.
These macros and functions are not prefixed with TRIBITS_
. However, there is really not a large risk to defining and using these non-namespaces utility functions and macros. It turns out that CMake allows one to redefine any macro or function, even built-in ones, inside of one's project. Therefore, even if CMake did add new commands that clashed with these names, there would be no conflict. When overriding a built-in command, e.g. some_builtin_command()
, one can always access the original built-in command as _some_builtin_command()
.