From 4a97517996cc04de6f0285cdd4fbbb40b269a6b3 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Tue, 3 May 2011 17:43:12 +0200 Subject: [PATCH] Updates in testing - replaced include(ctest) with enable_testing(), which is enough to run "make test" - added a new variable CLITK_BUILD_TESTING to siwtch tests on/off + we may need to change this when using CDash for testing... --- CMakeLists.txt | 7 ++++--- tests/CMakeLists.txt | 10 +++++----- tests/tools/CMakeLists.txt | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de9c55b..ea1eb47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,11 +99,12 @@ ENDIF(CLITK_BUILD_VV) #========================================================= #Support for the CTest dashboard testing system -INCLUDE(CTest) +OPTION(CLITK_BUILD_TESTING "Build the testing tree" OFF) #========================================================= -IF (BUILD_TESTING) +IF (CLITK_BUILD_TESTING) + ENABLE_TESTING() ADD_SUBDIRECTORY(tests) -ENDIF(BUILD_TESTING) +ENDIF(CLITK_BUILD_TESTING) #========================================================= diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1e5595b..e15b097 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,15 +1,15 @@ # Tests are organized to mirror the clitk directory tree. # Eacho subdirectory has its own CMakeLists.txt with the compiling directives -IF (BUILD_TESTING) +IF (CLITK_BUILD_TESTING) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin) # default data path is searched in the project source tree FIND_PATH(CLITK_DATA_PATH data PATHS ${PROJECT_SOURCE_DIR}) - IF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND") - MESSAGE(FATAL_ERROR "Data path must be given when tests are enabled.") - ENDIF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND") + IF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND" OR CLITK_DATA_PATH STREQUAL "") + MESSAGE("Data path must be given when tests are enabled.") + ENDIF (CLITK_DATA_PATH STREQUAL "CLITK_DATA_PATH-NOTFOUND" OR CLITK_DATA_PATH STREQUAL "") set(CLITK_DATA_PATH ${CLITK_DATA_PATH}/data) ADD_DEFINITIONS(-DCLITK_DATA_PATH='"${CLITK_DATA_PATH}"') @@ -19,4 +19,4 @@ IF (BUILD_TESTING) #ADD_SUBDIRECTORY(registration) #ADD_SUBDIRECTORY(common) -ENDIF(BUILD_TESTING) +ENDIF(CLITK_BUILD_TESTING) diff --git a/tests/tools/CMakeLists.txt b/tests/tools/CMakeLists.txt index f915a5b..950194e 100644 --- a/tests/tools/CMakeLists.txt +++ b/tests/tools/CMakeLists.txt @@ -2,7 +2,7 @@ # Test apps are compiled as any other app in the # project. Test executions are run using "make test" # -IF(BUILD_TESTING) +IF(CLITK_BUILD_TESTING) # clitkImageInfo ADD_EXECUTABLE(clitkImageInfoTest clitkImageInfoTest.cxx) @@ -14,4 +14,4 @@ IF(BUILD_TESTING) TARGET_LINK_LIBRARIES(clitkWriteDicomSeriesTest ITKIO) ADD_TEST(NAME clitkWriteDicomSeriesTest COMMAND clitkWriteDicomSeriesTest) -ENDIF(BUILD_TESTING) +ENDIF(CLITK_BUILD_TESTING) -- 2.47.1