2 #=============================================================================
3 # Copyright 2005-2009 Kitware, Inc.
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12 # (To distribute this file outside of CMake, substitute the full
13 # License text for the above reference.)
15 if(NOT RUN_FROM_CTEST_OR_DART)
16 message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
19 # make directories in the binary tree
20 file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary)
21 get_filename_component(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH)
22 set(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH})
23 find_program(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH})
24 mark_as_advanced(CMAKE_CTEST_COMMAND)
31 ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
32 ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
35 ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
36 ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
42 # Custom targets to perform dashboard builds and submissions.
43 # These should NOT need to be modified from project to project.
47 if(CMAKE_CONFIGURATION_TYPES)
48 # We need to pass the configuration type on the test command line.
49 set(__conf_types -C "${CMAKE_CFG_INTDIR}")
52 # Add convenience targets. Do this at most once in case of nested
54 define_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED
55 BRIEF_DOCS "Internal property used by CTestTargets module."
56 FULL_DOCS "Set by the CTestTargets module to track addition of testing targets."
58 get_property(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
59 if(NOT _CTEST_TARGETS_ADDED)
60 set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
62 # For all generators add basic testing targets.
63 foreach(mode Experimental Nightly Continuous NightlyMemoryCheck)
64 add_custom_target(${mode}
65 ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
67 set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
68 set_property(TARGET ${mode} PROPERTY FOLDER "CTestDashboardTargets")
71 # For Makefile generators add more granular targets.
72 if("${CMAKE_GENERATOR}" MATCHES "(Ninja|Make)")
73 # Make targets for Experimental builds
74 foreach(mode Nightly Experimental Continuous)
76 Start Update Configure Build Test Coverage MemCheck Submit
79 add_custom_target(${mode}${testtype}
80 ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
82 set_property(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
83 set_property(TARGET ${mode}${testtype} PROPERTY FOLDER "CTestDashboardTargets")
88 # If requested, add an alias that is the equivalent of the built-in "test"
89 # or "RUN_TESTS" target:
90 if(CTEST_TEST_TARGET_ALIAS)
91 add_custom_target(${CTEST_TEST_TARGET_ALIAS}
92 ${CMAKE_CTEST_COMMAND} ${__conf_types}