2007-05-15 18:23:40 +04:00
|
|
|
# - Configure a project for testing with CTest/Dart
|
2006-05-25 18:21:46 +04:00
|
|
|
# This file configures a project to use the CTest/Dart
|
2007-05-15 18:23:40 +04:00
|
|
|
# testing/dashboard process. This module should be included
|
|
|
|
# in the CMakeLists.txt file at the top of a project. Typical usage:
|
|
|
|
# INCLUDE(CTest)
|
|
|
|
# IF(BUILD_TESTING)
|
|
|
|
# # ... testing related CMake code ...
|
|
|
|
# ENDIF(BUILD_TESTING)
|
|
|
|
# The BUILD_TESTING option is created by the CTest module to determine
|
|
|
|
# whether testing support should be enabled. The default is ON.
|
|
|
|
|
2006-06-28 23:15:01 +04:00
|
|
|
OPTION(BUILD_TESTING "Build the testing tree." ON)
|
2005-08-03 21:19:36 +04:00
|
|
|
|
|
|
|
IF(BUILD_TESTING)
|
|
|
|
# Setup some auxilary macros
|
|
|
|
MACRO(SET_IF_NOT_SET var val)
|
2006-04-21 22:36:48 +04:00
|
|
|
IF(NOT DEFINED "${var}")
|
2005-08-03 21:19:36 +04:00
|
|
|
SET("${var}" "${val}")
|
2006-04-21 22:36:48 +04:00
|
|
|
ENDIF(NOT DEFINED "${var}")
|
2005-08-03 21:19:36 +04:00
|
|
|
ENDMACRO(SET_IF_NOT_SET)
|
|
|
|
|
|
|
|
MACRO(SET_IF_SET var val)
|
2007-12-18 01:05:07 +03:00
|
|
|
IF(NOT "${val}" MATCHES "^$")
|
2005-08-03 21:19:36 +04:00
|
|
|
SET("${var}" "${val}")
|
2007-12-18 01:05:07 +03:00
|
|
|
ENDIF(NOT "${val}" MATCHES "^$")
|
2005-08-03 21:19:36 +04:00
|
|
|
ENDMACRO(SET_IF_SET)
|
|
|
|
|
2006-04-28 17:58:15 +04:00
|
|
|
MACRO(SET_IF_SET_AND_NOT_SET var val)
|
2007-12-18 01:05:07 +03:00
|
|
|
IF(NOT "${val}" MATCHES "^$")
|
2006-04-28 17:58:15 +04:00
|
|
|
SET_IF_NOT_SET("${var}" "${val}")
|
2007-12-18 01:05:07 +03:00
|
|
|
ENDIF(NOT "${val}" MATCHES "^$")
|
2006-04-28 17:58:15 +04:00
|
|
|
ENDMACRO(SET_IF_SET_AND_NOT_SET)
|
|
|
|
|
2005-08-03 21:19:36 +04:00
|
|
|
# Make sure testing is enabled
|
|
|
|
ENABLE_TESTING()
|
|
|
|
|
2006-04-21 22:36:48 +04:00
|
|
|
IF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
|
|
|
|
INCLUDE("${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
|
2006-04-28 17:58:15 +04:00
|
|
|
SET_IF_SET_AND_NOT_SET(NIGHTLY_START_TIME "${CTEST_NIGHTLY_START_TIME}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_METHOD "${CTEST_DROP_METHOD}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_SITE "${CTEST_DROP_SITE}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_SITE_USER "${CTEST_DROP_SITE_USER}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_SITE_PASSWORD "${CTEST_DROP_SITE_PASWORD}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(DROP_LOCATION "${CTEST_DROP_LOCATION}")
|
|
|
|
SET_IF_SET_AND_NOT_SET(TRIGGER_SITE "${CTEST_TRIGGER_SITE}")
|
ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions
Alex
2007-05-17 21:20:44 +04:00
|
|
|
SET_IF_SET_AND_NOT_SET(UPDATE_TYPE "${CTEST_UPDATE_TYPE}")
|
2006-04-21 22:36:48 +04:00
|
|
|
ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake")
|
|
|
|
|
2005-08-03 21:19:36 +04:00
|
|
|
# the project can have a DartConfig.cmake file
|
|
|
|
IF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
|
|
|
|
INCLUDE("${PROJECT_SOURCE_DIR}/DartConfig.cmake")
|
|
|
|
ELSE(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
|
|
|
|
|
|
|
|
# Dashboard is opened for submissions for a 24 hour period starting at
|
|
|
|
# the specified NIGHTLY_START_TIME. Time is specified in 24 hour format.
|
|
|
|
SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
|
2006-06-23 15:08:37 +04:00
|
|
|
SET_IF_NOT_SET(DROP_METHOD "http")
|
2005-08-03 21:19:36 +04:00
|
|
|
|
|
|
|
# Dart server to submit results (used by client)
|
|
|
|
# There should be an option to specify submit method, but I will leave it
|
|
|
|
# commented until we decide what to do with it.
|
|
|
|
# SET(DROP_METHOD "http" CACHE STRING "Set the CTest submit method. Valid options are http and ftp")
|
|
|
|
IF(DROP_METHOD MATCHES http)
|
|
|
|
SET_IF_NOT_SET (DROP_SITE "public.kitware.com")
|
|
|
|
SET_IF_NOT_SET (DROP_LOCATION "/cgi-bin/HTTPUploadDartFile.cgi")
|
|
|
|
ELSE(DROP_METHOD MATCHES http)
|
|
|
|
SET_IF_NOT_SET (DROP_SITE "public.kitware.com")
|
|
|
|
SET_IF_NOT_SET (DROP_LOCATION "/incoming")
|
|
|
|
SET_IF_NOT_SET (DROP_SITE_USER "anonymous")
|
|
|
|
SET_IF_NOT_SET (DROP_SITE_PASSWORD "random@someplace.com")
|
|
|
|
SET_IF_NOT_SET (DROP_SITE_MODE "active")
|
|
|
|
ENDIF(DROP_METHOD MATCHES http)
|
|
|
|
SET_IF_NOT_SET (TRIGGER_SITE "http://${DROP_SITE}/cgi-bin/Submit-Random-TestingResults.cgi")
|
|
|
|
SET_IF_NOT_SET (COMPRESS_SUBMISSION ON)
|
|
|
|
|
|
|
|
# Dart server configuration
|
|
|
|
SET (ROLLUP_URL "http://${DROP_SITE}/cgi-bin/random-rollup-dashboard.sh")
|
|
|
|
#SET (CVS_WEB_URL "")
|
|
|
|
#SET (CVS_WEB_CVSROOT "")
|
|
|
|
|
|
|
|
#SET (USE_DOXYGEN "Off")
|
|
|
|
#SET (DOXYGEN_URL "" )
|
|
|
|
ENDIF(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake")
|
2006-04-21 22:36:48 +04:00
|
|
|
SET_IF_NOT_SET (NIGHTLY_START_TIME "00:00:00 EDT")
|
2005-08-03 21:19:36 +04:00
|
|
|
|
|
|
|
# make program just needs to use CMAKE_MAKE_PROGRAM which is required
|
|
|
|
# to be defined by cmake
|
|
|
|
SET(MAKEPROGRAM ${CMAKE_MAKE_PROGRAM})
|
|
|
|
|
|
|
|
FIND_PROGRAM(CVSCOMMAND cvs )
|
2006-05-25 18:21:46 +04:00
|
|
|
SET(CVS_UPDATE_OPTIONS "-d -A -P" CACHE STRING
|
|
|
|
"Options passed to the cvs update command.")
|
2005-08-03 21:19:36 +04:00
|
|
|
FIND_PROGRAM(SVNCOMMAND svn)
|
|
|
|
|
|
|
|
IF(NOT UPDATE_TYPE)
|
|
|
|
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
|
|
|
|
SET(UPDATE_TYPE cvs)
|
|
|
|
ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
|
|
|
|
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
|
|
|
|
SET(UPDATE_TYPE svn)
|
|
|
|
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
|
|
|
|
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS")
|
|
|
|
ENDIF(NOT UPDATE_TYPE)
|
|
|
|
|
|
|
|
IF(NOT UPDATE_TYPE)
|
2008-03-17 18:10:32 +03:00
|
|
|
IF(NOT __CTEST_UPDATE_TYPE_COMPLAINED)
|
|
|
|
SET(__CTEST_UPDATE_TYPE_COMPLAINED 1 CACHE INTERNAL "Already complained about update type.")
|
|
|
|
MESSAGE(STATUS "CTest cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work.")
|
|
|
|
ENDIF(NOT __CTEST_UPDATE_TYPE_COMPLAINED)
|
2005-08-03 21:19:36 +04:00
|
|
|
ENDIF(NOT UPDATE_TYPE)
|
|
|
|
|
|
|
|
IF(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
|
|
|
|
SET(UPDATE_COMMAND "${CVSCOMMAND}")
|
|
|
|
SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}")
|
|
|
|
ELSE(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
|
|
|
|
IF(UPDATE_TYPE MATCHES "[Ss][Vv][Nn]")
|
|
|
|
SET(UPDATE_COMMAND "${SVNCOMMAND}")
|
|
|
|
SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}")
|
|
|
|
ENDIF(UPDATE_TYPE MATCHES "[Ss][Vv][Nn]")
|
|
|
|
ENDIF(UPDATE_TYPE MATCHES "[Cc][Vv][Ss]")
|
|
|
|
|
2006-05-25 18:21:46 +04:00
|
|
|
SET(DART_TESTING_TIMEOUT 1500 CACHE STRING
|
|
|
|
"Maximum time allowed before CTest will kill the test.")
|
2005-08-03 21:19:36 +04:00
|
|
|
|
|
|
|
FIND_PROGRAM(MEMORYCHECK_COMMAND
|
|
|
|
NAMES purify valgrind boundscheck
|
|
|
|
PATHS
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
|
|
|
|
DOC "Path to the memory checking command, used for memory error detection."
|
|
|
|
)
|
2006-05-25 18:21:46 +04:00
|
|
|
SET(MEMORYCHECK_SUPPRESSIONS_FILE "" CACHE FILEPATH
|
|
|
|
"File that contains suppressions for the memory checker")
|
|
|
|
FIND_PROGRAM(SCPCOMMAND scp DOC
|
|
|
|
"Path to scp command, used by CTest for submitting results to a Dart server"
|
|
|
|
)
|
|
|
|
FIND_PROGRAM(COVERAGE_COMMAND gcov DOC
|
|
|
|
"Path to the coverage program that CTest uses for performing coverage inspection"
|
|
|
|
)
|
2005-08-03 21:19:36 +04:00
|
|
|
|
|
|
|
# set the site name
|
|
|
|
SITE_NAME(SITE)
|
|
|
|
# set the build name
|
|
|
|
IF(NOT BUILDNAME)
|
|
|
|
SET(DART_COMPILER "${CMAKE_CXX_COMPILER}")
|
|
|
|
IF(NOT DART_COMPILER)
|
|
|
|
SET(DART_COMPILER "${CMAKE_C_COMPILER}")
|
|
|
|
ENDIF(NOT DART_COMPILER)
|
|
|
|
IF(NOT DART_COMPILER)
|
|
|
|
SET(DART_COMPILER "unknown")
|
|
|
|
ENDIF(NOT DART_COMPILER)
|
|
|
|
IF(WIN32)
|
|
|
|
SET(DART_NAME_COMPONENT "NAME_WE")
|
|
|
|
ELSE(WIN32)
|
|
|
|
SET(DART_NAME_COMPONENT "NAME")
|
|
|
|
ENDIF(WIN32)
|
|
|
|
IF(NOT BUILD_NAME_SYSTEM_NAME)
|
|
|
|
SET(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
|
|
|
|
ENDIF(NOT BUILD_NAME_SYSTEM_NAME)
|
|
|
|
IF(WIN32)
|
|
|
|
SET(BUILD_NAME_SYSTEM_NAME "Win32")
|
|
|
|
ENDIF(WIN32)
|
|
|
|
IF(UNIX OR BORLAND)
|
2006-05-25 18:21:46 +04:00
|
|
|
GET_FILENAME_COMPONENT(DART_CXX_NAME
|
|
|
|
"${CMAKE_CXX_COMPILER}" ${DART_NAME_COMPONENT})
|
2005-08-03 21:19:36 +04:00
|
|
|
ELSE(UNIX OR BORLAND)
|
2006-05-25 18:21:46 +04:00
|
|
|
GET_FILENAME_COMPONENT(DART_CXX_NAME
|
|
|
|
"${CMAKE_BUILD_TOOL}" ${DART_NAME_COMPONENT})
|
2005-08-03 21:19:36 +04:00
|
|
|
ENDIF(UNIX OR BORLAND)
|
|
|
|
IF(DART_CXX_NAME MATCHES "msdev")
|
|
|
|
SET(DART_CXX_NAME "vs60")
|
|
|
|
ENDIF(DART_CXX_NAME MATCHES "msdev")
|
|
|
|
IF(DART_CXX_NAME MATCHES "devenv")
|
|
|
|
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
|
|
|
|
SET(DART_CXX_NAME "vs70")
|
|
|
|
ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
|
|
|
|
IF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
|
|
|
|
SET(DART_CXX_NAME "vs71")
|
|
|
|
ELSE(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
|
|
|
|
SET(DART_CXX_NAME "vs8")
|
|
|
|
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7 .NET 2003$")
|
|
|
|
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio 7$")
|
|
|
|
ENDIF(DART_CXX_NAME MATCHES "devenv")
|
|
|
|
SET(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}")
|
|
|
|
ENDIF(NOT BUILDNAME)
|
|
|
|
# set the build command
|
|
|
|
BUILD_COMMAND(MAKECOMMAND ${MAKEPROGRAM} )
|
|
|
|
|
|
|
|
MARK_AS_ADVANCED(
|
|
|
|
COVERAGE_COMMAND
|
|
|
|
CVSCOMMAND
|
|
|
|
SVNCOMMAND
|
|
|
|
CVS_UPDATE_OPTIONS
|
|
|
|
SVN_UPDATE_OPTIONS
|
|
|
|
MAKECOMMAND
|
|
|
|
MEMORYCHECK_COMMAND
|
|
|
|
MEMORYCHECK_SUPPRESSIONS_FILE
|
|
|
|
PURIFYCOMMAND
|
|
|
|
SCPCOMMAND
|
|
|
|
SITE
|
|
|
|
)
|
|
|
|
# BUILDNAME
|
|
|
|
IF(NOT RUN_FROM_DART)
|
|
|
|
SET(RUN_FROM_CTEST_OR_DART 1)
|
|
|
|
INCLUDE(CTestTargets)
|
|
|
|
SET(RUN_FROM_CTEST_OR_DART)
|
|
|
|
ENDIF(NOT RUN_FROM_DART)
|
|
|
|
ENDIF(BUILD_TESTING)
|