# of complexity :-(
#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
MESSAGE(STATUS "Proceed to test definitions now.")
+PROJECT(deal.II-testsuite)
ENABLE_TESTING()
+SET(_options)
+IF("${CMAKE_PROJECT_NAME}" STREQUAL "deal.II")
+ #
+ # Setup for the case that this folder is included as a subfolder in a
+ # deal.II project:
+ #
+
+ # Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR:
+ FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
+ "SUBDIRS(tests)"
+ )
+
+ LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
+ LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
+
+ELSE()
+
+ #
+ # Set up a top level test suite project:
+ #
+
+ SET(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ENDIF()
+
#
-# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR:
+# Pass all relevant "TEST_" variables down to the subprojects:
#
-FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
- "SUBDIRS(tests)"
- )
+GET_CMAKE_PROPERTY(_variables VARIABLES)
+FOREACH(_var ${_variables})
+ IF(_var MATCHES
+ "^(TEST_DIR|TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$"
+ )
+ LIST(APPEND _options -D${_var}="${${_var}}")
+ ENDIF()
+ENDFOREACH()
#
# Two custom targets to setup and cleanup the testsuite:
LIST(APPEND _categories umfpack)
ENDIF()
-#
-# Pass all relevant "TEST_" variables down to the subprojects:
-#
-
-GET_CMAKE_PROPERTY(_variables VARIABLES)
-SET(_options)
-FOREACH(_var ${_variables})
- IF(_var MATCHES
- "^(TEST_DIR|TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$"
- )
- LIST(APPEND _options -D${_var}="${${_var}}")
- ENDIF()
-ENDFOREACH()
-
#
# The hook into CTest so that the tests from the suprojects get picked up
# by the main project:
${CMAKE_CURRENT_BINARY_DIR}/${_category}
COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/${_category} &&
${CMAKE_COMMAND} -G${CMAKE_GENERATOR}
- -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
- -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}
${_options}
${CMAKE_CURRENT_SOURCE_DIR}/${_category}
> /dev/null # Shoo!
SET(_category all-headers)
SET(_count "0")
-FILE(GLOB_RECURSE _header ${DEAL_II_SOURCE_DIR}/include/*.h)
+
+IF(NOT"${DEAL_II_SOURCE_DIR}" STREQUAL "")
+ # The testsuite was configured as part of a deal.II project, so pick up
+ # the headers from the corresponding source directory:
+ FILE(GLOB_RECURSE _header ${DEAL_II_SOURCE_DIR}/include/deal.II/*.h)
+ELSE()
+ # The testsuite was configured as an independent project, so pick up
+ # headers from an external deal.II build directory, or installation:
+ IF(DEAL_II_BUILD_DIR)
+ LIST(GET DEAL_II_INCLUDE_DIRS 2 _header_dir)
+ ELSE()
+ LIST(GET DEAL_II_INCLUDE_DIRS 0 _header_dir)
+ ENDIF()
+ FILE(GLOB_RECURSE _header ${_header_dir}/deal.II/*.h)
+ MESSAGE(FATAL_ERROR ${_header_dir})
+ENDIF()
FOREACH(_full_file ${_header})
GET_FILENAME_COMPONENT(_file ${_full_file} NAME)
step-47 step-48 step-49
)
+IF(NOT"${DEAL_II_SOURCE_DIR}" STREQUAL "")
+ # The testsuite was configured as part of a deal.II project, so pick up
+ # the steps rom the corresponding source directory:
+ FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*)
+ELSE()
+ # The testsuite was configured as an independent project, so pick up
+ # headers from an external deal.II build directory, or installation:
+ FILE(GLOB _steps ${DEAL_II_PATH}/${DEAL_II_EXAMPLES_RELDIR}/step-*)
+ # TODO: What do in case of a build dir?
+ENDIF()
+
SET(_count "0")
-FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*)
FOREACH(_step_full ${_steps})
GET_FILENAME_COMPONENT(_step ${_step_full} NAME)
SET_IF_EMPTY(TEST_TIME_LIMIT $ENV{TEST_TIME_LIMIT})
SET_IF_EMPTY(TEST_PICKUP_REGEX $ENV{TEST_PICKUP_REGEX})
-IF("${DEAL_II_BINARY_DIR}" STREQUAL "")
- MESSAGE(FATAL_ERROR "DEAL_II_BINARY_DIR must be set for this test subproject to configure correctly")
-ENDIF()
-IF("${DEAL_II_SOURCE_DIR}" STREQUAL "")
- MESSAGE(FATAL_ERROR "DEAL_II_SOURCE_DIR must be set for this test subproject to configure correctly")
-ENDIF()
-
#
# We need deal.II and Perl as external packages:
#
-FIND_PACKAGE(deal.II 8.1 REQUIRED
+FIND_PACKAGE(deal.II 8.0 REQUIRED
HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR}
)
INCLUDE(${DEAL_II_TARGET_CONFIG})