ENH: fix bug where sharedforward would not work if there was a space in the path...
[cmake.git] / Modules / CTestTargets.cmake
blob87f581988ca63938faf5ba422fe042022da4c38f
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   ENDFOREACH(mode)
55   # For Makefile generators add more granular targets.
56   IF("${CMAKE_GENERATOR}" MATCHES Make)
57     # Make targets for Experimental builds
58     FOREACH(mode Nightly Experimental Continuous)
59       FOREACH(testtype
60           Start Update Configure Build Test Coverage MemCheck Submit
61           # missing purify
62           )
63         ADD_CUSTOM_TARGET(${mode}${testtype}
64           ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode}${testtype}
65           )
66       ENDFOREACH(testtype)
67     ENDFOREACH(mode)
68   ENDIF("${CMAKE_GENERATOR}" MATCHES Make)
69 ENDIF(NOT _CTEST_TARGETS_ADDED)