summaryrefslogtreecommitdiffstats
path: root/Modules/CTestTargets.cmake
blob: bb4cdeefa6a16d993cac90f8dc18b4b80d1b7863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
IF(NOT RUN_FROM_CTEST_OR_DART)
  MESSAGE(FATAL_ERROR "Do not incldue CTestTargets.cmake directly")
ENDIF(NOT RUN_FROM_CTEST_OR_DART)

# 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)

# Use CTest
# configure files

IF(CTEST_NEW_FORMAT)
  CONFIGURE_FILE(
    ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
    ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
ELSE(CTEST_NEW_FORMAT)
  CONFIGURE_FILE(
    ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
    ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
ENDIF(CTEST_NEW_FORMAT)

#
# 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(CMAKE_CONFIGURATION_TYPES)

# add testing targets
IF(${CMAKE_MAKE_PROGRAM} MATCHES make)
  FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
    ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode})
  ENDFOREACH(mode)
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES make)
  # for IDE only add them once for nested projects
  IF (NOT DART_COMMON_TARGETS_ADDED)
    FOREACH(mode Experimental Nightly Continuous NightlyMemoryCheck)
      ADD_CUSTOM_TARGET(${mode} ${CMAKE_CTEST_COMMAND} ${__conf_types} -D ${mode})
    ENDFOREACH(mode)
    SET (DART_COMMON_TARGETS_ADDED 1)
  ENDIF (NOT DART_COMMON_TARGETS_ADDED)
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES make)


# for non IDE based builds nmake and make 
# add all these extra targets 
IF(${CMAKE_MAKE_PROGRAM} MATCHES 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})
    ENDFOREACH(testtype)
  ENDFOREACH(mode)
ENDIF (${CMAKE_MAKE_PROGRAM} MATCHES make)