CMAKE_POLICY(SET CMP0037 OLD)
ENDIF()
-
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
#
## ---------------------------------------------------------------------
#
-# Setup the testsuite.
+# Set up the testsuite.
#
# We define toplevel targets:
# setup_tests - set up testsuite subprojects
# prune_tests - remove all testsuite subprojects
#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
+
+MACRO(SET_IF_EMPTY _variable)
+ IF("${${_variable}}" STREQUAL "")
+ SET(${_variable} ${ARGN})
+ ENDIF()
+ENDMACRO()
+
SET_IF_EMPTY(MAKEOPTS $ENV{MAKEOPTS})
-#
-# First of all, our quicktests:
-#
+IF(DEFINED DEAL_II_HAVE_TESTS_DIRECTORY)
-ADD_SUBDIRECTORY(quick_tests)
+ IF(POLICY CMP0037)
+ # allow to override "test" target for quick tests
+ CMAKE_POLICY(SET CMP0037 OLD)
+ ENDIF()
-#
-# Write minimalistic CTestTestfile.cmake files to CMAKE_BINARY_DIR and
-# CMAKE_BINARY_DIR/tests:
-#
+ #
+ # If this CMakeLists.txt file is called from within the deal.II build
+ # system, set up quick tests as well:
+ #
+ ADD_SUBDIRECTORY(quick_tests)
+
+ MESSAGE(STATUS "Setting up testsuite")
-MESSAGE(STATUS "Setting up testsuite")
+ #
+ # Write minimalistic CTestTestfile.cmake files to CMAKE_BINARY_DIR and
+ # CMAKE_BINARY_DIR/tests:
+ #
+ FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "SUBDIRS(tests)")
-FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "SUBDIRS(tests)")
-FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "")
+ SET(_options "-DDEAL_II_DIR=${CMAKE_BINARY_DIR}")
+
+ELSE()
+
+ MESSAGE(STATUS "This is CMake ${CMAKE_VERSION}")
+ MESSAGE(STATUS "")
+
+ IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+ MESSAGE(FATAL_ERROR "The testsuite cannot be configured in-source. "
+ "Please create a separate build directory"
+ )
+ ENDIF()
+
+ FIND_PACKAGE(deal.II 8.3 REQUIRED HINTS ${DEAL_II_DIR} $ENV{DEAL_II_DIR})
+ PROJECT(testsuite NONE)
+ SET(_options "-DDEAL_II_DIR=${DEAL_II_PATH}")
+ENDIF()
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake "")
#
-# A config line for tests:
+# Append further configuration to _options:
#
-
-SET(_options "")
-LIST(APPEND _options
- -DDEAL_II_DIR=${CMAKE_BINARY_DIR}
- -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}
- )
FOREACH(_var
DIFF_DIR NUMDIFF_DIR TEST_DIFF TEST_PICKUP_REGEX TEST_TIME_LIMIT
MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS
ADD_CUSTOM_TARGET(clean_tests)
FOREACH(_category ${_categories})
- SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category})
+ SET(_category_dir ${CMAKE_CURRENT_SOURCE_DIR}/${_category})
ADD_CUSTOM_TARGET(setup_tests_${_category}
COMMAND ${CMAKE_COMMAND} -E make_directory
- ${CMAKE_BINARY_DIR}/tests/${_category}
- COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} &&
+ ${CMAKE_CURRENT_BINARY_DIR}/${_category}
+ COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/${_category} &&
${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir}
> /dev/null
COMMENT "Processing tests/${_category}"
ADD_CUSTOM_TARGET(prune_tests_${_category}
COMMAND ${CMAKE_COMMAND} -E remove_directory
- ${CMAKE_BINARY_DIR}/tests/${_category}
+ ${CMAKE_CURRENT_BINARY_DIR}/${_category}
COMMENT "Processing tests/${_category}"
)
ADD_DEPENDENCIES(prune_tests prune_tests_${_category})
ADD_CUSTOM_TARGET(regen_tests_${_category}
COMMAND
- test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND}
- --build ${CMAKE_BINARY_DIR}/tests/${_category} --target regenerate
+ test ! -d ${CMAKE_CURRENT_BINARY_DIR}/${_category} || ${CMAKE_COMMAND}
+ --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target regenerate
COMMENT "Processing tests/${_category}"
)
ADD_DEPENDENCIES(regen_tests regen_tests_${_category})
ADD_CUSTOM_TARGET(clean_tests_${_category}
COMMAND
- test ! -d ${CMAKE_BINARY_DIR}/tests/${_category} || ${CMAKE_COMMAND}
- --build ${CMAKE_BINARY_DIR}/tests/${_category} --target clean
+ test ! -d ${CMAKE_CURRENT_BINARY_DIR}/${_category} || ${CMAKE_COMMAND}
+ --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target clean
COMMENT "Processing tests/${_category}"
)
ADD_DEPENDENCIES(clean_tests clean_tests_${_category})
- FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake
+ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake
"SUBDIRS(${_category})\n"
)
ENDFOREACH()
-MESSAGE(STATUS "Setting up testsuite - Done")
+IF(DEFINED DEAL_II_HAVE_TESTS_DIRECTORY)
+ MESSAGE(STATUS "Setting up testsuite - Done")
+ENDIF()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
#
# Glob together all header files and strip SOURCE_DIR/include/deal.II to
# get a correct relative path:
#
-FILE(GLOB_RECURSE _headers RELATIVE ${DEAL_II_SOURCE_DIR}/include/deal.II
- ${DEAL_II_SOURCE_DIR}/include/deal.II/*.h
+IF(DEAL_II_BUILD_DIR)
+ LIST(GET DEAL_II_INCLUDE_DIRS 1 _include_dir)
+ELSE()
+ LIST(GET DEAL_II_INCLUDE_DIRS 0 _include_dir)
+ENDIF()
+FILE(GLOB_RECURSE _headers RELATIVE ${_include_dir}/deal.II
+ ${_include_dir}/deal.II/*.h
)
FOREACH(_header ${_headers})
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_ARPACK)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
#
step-47 step-48 step-49
)
-FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*)
+FILE(GLOB _steps ${DEAL_II_PATH}/${DEAL_II_EXAMPLES_RELDIR}/step-*)
FOREACH(_step_full ${_steps})
GET_FILENAME_COMPONENT(_step ${_step_full} NAME)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_P4EST)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST AND DEAL_II_WITH_PETSC AND DEAL_II_WITH_TRILINOS)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_LAPACK)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
## ---------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_METIS)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_OPENCASCADE)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_PETSC)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_PETSC AND DEAL_II_WITH_SLEPC)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_TRILINOS)
DEAL_II_PICKUP_TESTS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
-INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake)
+INCLUDE(../setup_testsubproject.cmake)
PROJECT(testsuite CXX)
IF(DEAL_II_WITH_UMFPACK)
DEAL_II_PICKUP_TESTS()