1 # - Configure a project for testing with CTest/Dart
2 # This file configures a project to use the CTest/Dart
3 # testing/dashboard process. This module should be included
4 # in the CMakeLists.txt file at the top of a project. Typical usage:
7 # # ... testing related CMake code ...
9 # The BUILD_TESTING option is created by the CTest module to determine
10 # whether testing support should be enabled. The default is ON.
12 OPTION(BUILD_TESTING "Build the testing tree." ON)
15 # Setup some auxilary macros
16 MACRO(SET_IF_NOT_SET var val)
17 IF(NOT DEFINED "${var}")
18 SET("${var}" "${val}")
19 ENDIF(NOT DEFINED "${var}")
20 ENDMACRO(SET_IF_NOT_SET)
22 MACRO(SET_IF_SET var val)
23 IF(NOT "${val}" MATCHES "^$")
24 SET("${var}" "${val}")
25 ENDIF(NOT "${val}" MATCHES "^$")
28 MACRO(SET_IF_SET_AND_NOT_SET var val)
29 IF(NOT "${val}" MATCHES "^$")
30 SET_IF_NOT_SET("${var}" "${val}")
31 ENDIF(NOT "${val}" MATCHES "^$")
32 ENDMACRO(SET_IF_SET_AND_NOT_SET)
34 # Make sure testing is enabled
37 IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
38 INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
39 SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}")
40 SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}")
41 SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}")
42 SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
43 SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}")
44 SET_IF_SET_AND_NOT_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}")
45 SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}")
46 SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}")
47 SET_IF_SET_AND_NOT_SET(UPDATE_TYPE "${CTEST_UPDATE_TYPE}")
48 ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
50 # the project can have a DartConfig.cmake file
51 IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
52 INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake")
53 ELSE(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
55 # Dashboard is opened for submissions for a 24 hour period starting at
56 # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format.
57 SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
58 SET_IF_NOT_SET(DROP_METHOD "http")
60 # Dart server to submit results (used by client)
61 # There should be an option to specify submit method, but I will leave it
62 # commented until we decide what to do with it.
63 # SET(DROP_METHOD "http" CACHE STRING "Set the CTest submit method. Valid options are http and ftp")
64 IF(DROP_METHOD MATCHES http)
65 SET_IF_NOT_SET (DROP_SITE "public.kitware.com")
66 SET_IF_NOT_SET (DROP_LOCATION "/cgi-bin/HTTPUploadDartFile.cgi")
67 ELSE(DROP_METHOD MATCHES http)
68 SET_IF_NOT_SET (DROP_SITE "public.kitware.com")
69 SET_IF_NOT_SET (DROP_LOCATION "/incoming")
70 SET_IF_NOT_SET (DROP_SITE_USER "anonymous")
71 SET_IF_NOT_SET (DROP_SITE_PASSWORD "random@someplace.com")
72 SET_IF_NOT_SET (DROP_SITE_MODE "active")
73 ENDIF(DROP_METHOD MATCHES http)
74 SET_IF_NOT_SET (TRIGGER_SITE "http://${DROP_SITE}/cgi-bin/Submit-Random-TestingResults.cgi")
75 SET_IF_NOT_SET (COMPRESS_SUBMISSION ON)
77 # Dart server configuration
78 SET (ROLLUP_URL "http://${DROP_SITE}/cgi-bin/random-rollup-dashboard.sh")
80 #SET (CVS_WEB_CVSROOT "")
82 #SET (USE_DOXYGEN "Off")
83 #SET (DOXYGEN_URL "" )
84 ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
85 SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
87 # make program just needs to use CMAKE_MAKE_PROGRAM which is required
88 # to be defined by cmake
89 SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
91 FIND_PROGRAM(CVSCOMMAND cvs )
92 SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
93 "Options passed to the cvs update command.")
94 FIND_PROGRAM(SVNCOMMAND svn)
97 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
99 ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
100 IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
102 ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
103 ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
104 ENDIF(NOT UPDATE_TYPE)
107 MESSAGE(STATUS "Cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work.")
108 ENDIF(NOT UPDATE_TYPE)
110 IF(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
111 SET(UPDATE_COMMAND "${CVSCOMMAND}")
112 SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
113 ELSE(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
114 IF(UPDATE_TYPE MATCHES "[Ss][Vv][Nn]")
115 SET(UPDATE_COMMAND "${SVNCOMMAND}")
116 SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
117 ENDIF(UPDATE_TYPE MATCHES "[Ss][Vv][Nn]")
118 ENDIF(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
120 SET(DART_TESTING_TIMEOUT 1500 CACHE STRING
121 "Maximum time allowed before CTest will kill the test.")
123 FIND_PROGRAM(MEMORYCHECK_COMMAND
124 NAMES purify valgrind boundscheck
126 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
127 DOC "Path to the memory checking command, used for memory error detection."
129 SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
130 "File that contains suppressions for the memory checker")
131 FIND_PROGRAM(SCPCOMMAND scp DOC
132 "Path to scp command, used by CTest for submitting results to a Dart server"
134 FIND_PROGRAM(COVERAGE_COMMAND gcov DOC
135 "Path to the coverage program that CTest uses for performing coverage inspection"
142 SET(DART_COMPILER "${CMAKE_CXX_COMPILER}")
143 IF(NOT DART_COMPILER)
144 SET(DART_COMPILER "${CMAKE_C_COMPILER}")
145 ENDIF(NOT DART_COMPILER)
146 IF(NOT DART_COMPILER)
147 SET(DART_COMPILER "unknown")
148 ENDIF(NOT DART_COMPILER)
150 SET(DART_NAME_COMPONENT "NAME_WE")
152 SET(DART_NAME_COMPONENT "NAME")
154 IF(NOT BUILD_NAME_SYSTEM_NAME)
155 SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
156 ENDIF(NOT BUILD_NAME_SYSTEM_NAME)
158 SET(BUILD_NAME_SYSTEM_NAME "Win32")
161 GET_FILENAME_COMPONENT(DART_CXX_NAME
162 "${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
163 ELSE(UNIX OR BORLAND)
164 GET_FILENAME_COMPONENT(DART_CXX_NAME
165 "${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT})
166 ENDIF(UNIX OR BORLAND)
167 IF(DART_CXX_NAME MATCHES "msdev")
168 SET(DART_CXX_NAME "vs60")
169 ENDIF(DART_CXX_NAME MATCHES "msdev")
170 IF(DART_CXX_NAME MATCHES "devenv")
171 IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
172 SET(DART_CXX_NAME "vs70")
173 ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
174 IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
175 SET(DART_CXX_NAME "vs71")
176 ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
177 SET(DART_CXX_NAME "vs8")
178 ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
179 ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
180 ENDIF(DART_CXX_NAME MATCHES "devenv")
181 SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}")
183 # set the build command
184 BUILD_COMMAND(MAKECOMMAND ${MAKEPROGRAM} )
194 MEMORYCHECK_SUPPRESSIONS_FILE
200 IF(NOT RUN_FROM_DART)
201 SET(RUN_FROM_CTEST_OR_DART 1)
202 INCLUDE(CTestTargets)
203 SET(RUN_FROM_CTEST_OR_DART)
204 ENDIF(NOT RUN_FROM_DART)