Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Modules / CTestTargets.cmake
blob05ada72edab8909ec604e32ec2d8b9fa9197d7ea
1 IF(NOT RUN_FROM_CTEST_OR_DART)
2   MESSAGE(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
3 ENDIF(NOT RUN_FROM_CTEST_OR_DART)
5 # make directories in the binary tree
6 FILE(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary)
7 GET_FILENAME_COMPONENT(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH)
8 SET(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH})
9 FIND_PROGRAM(CMAKE_CTEST_COMMAND ctest ${CMAKE_HOST_PATH} ${CMAKE_TARGET_PATH})
10 MARK_AS_ADVANCED(CMAKE_CTEST_COMMAND)
12 # Use CTest
13 # configure files
15 IF(CTEST_NEW_FORMAT)
16   CONFIGURE_FILE(
17     ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
18     ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
19 ELSE(CTEST_NEW_FORMAT)
20   CONFIGURE_FILE(
21     ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
22     ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
23 ENDIF(CTEST_NEW_FORMAT)
26 # Section 3:
28 # Custom targets to perform dashboard builds and submissions.
29 # These should NOT need to be modified from project to project.
32 SET(__conf_types "")
33 IF(CMAKE_CONFIGURATION_TYPES)
34   # We need to pass the configuration type on the test command line.
35   SET(__conf_types -C "${CMAKE_CFG_INTDIR}")
36 ENDIF(CMAKE_CONFIGURATION_TYPES)
38 # Add convenience targets.  Do this at most once in case of nested
39 # projects.
40 DEFINE_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED
41   BRIEF_DOCS "Internal property used by CTestTargets module."
42   FULL_DOCS "Set by the CTestTargets module to track addition of testing targets."
43   )
44 GET_PROPERTY(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED)
45 IF(NOT _CTEST_TARGETS_ADDED)
46   SET_PROPERTY(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
48   # For all generators add basic testing targets.
49   FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
50     ADD_CUSTOM_TARGET(${mode}
51       ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}
52       )
53     SET_PROPERTY(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "")
54   ENDFOREACH(mode)
56   # For Makefile generators add more granular targets.
57   IF("${CMAKE_GENERATOR}" MATCHES Make)
58     # Make targets for Experimental builds
59     FOREACH(mode Nightly Experimental Continuous)
60       FOREACH(testtype
61           Start Update Configure Build Test Coverage MemCheck Submit
62           # missing purify
63           )
64         ADD_CUSTOM_TARGET(${mode}${testtype}
65           ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
66           )
67         SET_PROPERTY(TARGET ${mode}${testtype} PROPERTY RULE_LAUNCH_CUSTOM "")
68       ENDFOREACH(testtype)
69     ENDFOREACH(mode)
70   ENDIF("${CMAKE_GENERATOR}" MATCHES Make)
71 ENDIF(NOT _CTEST_TARGETS_ADDED)