CMake/Modules/CTestTargets.cmake

93 lines
3.0 KiB
CMake
Raw Normal View History

Simplify CMake per-source license notices Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2016-09-27 22:01:08 +03:00
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
if(NOT RUN_FROM_CTEST_OR_DART)
message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
endif()
2005-08-03 21:19:36 +04:00
if(NOT PROJECT_BINARY_DIR)
message(FATAL_ERROR "Do not include(CTest) before calling project().")
endif()
2005-08-03 21:19:36 +04:00
# make directories in the binary tree
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary)
get_filename_component(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH)
set(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH})
find_program(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH})
mark_as_advanced(CMAKE_CTEST_COMMAND)
2005-08-03 21:19:36 +04:00
# Use CTest
# configure files
if(CTEST_NEW_FORMAT)
configure_file(
2005-08-03 21:19:36 +04:00
${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
else()
configure_file(
2005-08-03 21:19:36 +04:00
${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
endif()
2005-08-03 21:19:36 +04:00
#
# Section 3:
#
# Custom targets to perform dashboard builds and submissions.
# These should NOT need to be modified from project to project.
#
set(__conf_types "")
if(CMAKE_CONFIGURATION_TYPES)
# We need to pass the configuration type on the test command line.
set(__conf_types -C "${CMAKE_CFG_INTDIR}")
endif()
# Add convenience targets. Do this at most once in case of nested
# projects.
define_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED
BRIEF_DOCS "Internal property used by CTestTargets module."
FULL_DOCS "Set by the CTestTargets module to track addition of testing targets."
)
get_property(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
if(NOT _CTEST_TARGETS_ADDED)
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
2005-08-03 21:19:36 +04:00
# For all generators add basic testing targets.
foreach(mode Experimental Nightly Continuous NightlyMemoryCheck)
add_custom_target(${mode}
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
USES_TERMINAL
)
set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
endforeach()
2005-08-03 21:19:36 +04:00
# For Makefile generators add more granular targets.
if("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)")
# Make targets for Experimental builds
foreach(mode Nightly Experimental Continuous)
foreach(testtype
Start Update Configure Build Test Coverage MemCheck Submit
# missing purify
)
add_custom_target(${mode}${testtype}
${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
USES_TERMINAL
)
set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
endforeach()
endforeach()
endif()
# If requested, add an alias that is the equivalent of the built-in "test"
# or "RUN_TESTS" target:
if(CTEST_TEST_TARGET_ALIAS)
add_custom_target(${CTEST_TEST_TARGET_ALIAS}
${CMAKE_CTEST_COMMAND} ${__conf_types}
USES_TERMINAL
)
endif()
endif()