CetCMakeSettings

Set defaults for CMake build settings as useful or required for building CET projects. Where appropriate, these settings may be changed via command line arguments to cmake or through ccmake/cmake-gui interfaces.

General Build Settings

The following CMake variables and options are configured by default when including this module:

  • CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE : ON
    • Force project directories to appear first in any list of include paths. This applies to both full paths and those created by generator expressions.
  • CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION : ON
    • CET policy is to install fully relocatable packages, so install directories should never be absolute. NB: This does not guarantee that a package is relocatable.
  • CMAKE_INSTALL_MESSAGE : LAZY
    • Only report new or updated files installed by the install target.
  • CMAKE_EXPORT_NO_PACKAGE_REGISTRY : ON
  • CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY : ON
  • CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY : ON
    • These variables are set to ensure that a project never creates or searches for config files in any package registry. This prevents the find_package command from locating potentially spurious config files.

In addition to the base setting above, configurable options are provided for enabling/disabling extra targets and functionality:

CET_BUILD_NO_UNINSTALL_TARGET

Option to disable creation of an uninstall target for the project. OFF by default, and marked as advanced.

See the documentation of the CetUninstallTarget module for more details on what this target does.

CTest/Testing Settings

BUILD_TESTING

Option to enable test infrastructure and settings, ON by default. After inclusion of this module, use CMake conditionals on BUILD_TESTING like

if(BUILD_TESTING)
  # ... code to create/build/configure tests ...
endif()

to only build/define tests when the variable is set.

At present, enabling testing only supports direct testing rather than use of the CTest module.

Todo

Add support for CTest. Should be matter of checking for a CTestConfig.cmake file in the project source dir.