From 21ee714222d92d9797174f66ce5a758dd33f407f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sat, 10 Dec 2022 00:29:36 -0600 Subject: [PATCH] Tests: Clean up top level CMakeLists.txt --- tests/CMakeLists.txt | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index cd22872439..5a3728162c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,6 +19,7 @@ # We define toplevel targets: # setup_tests - set up testsuite subprojects # prune_tests - remove all testsuite subprojects +# test - run all quick_tests # cmake_minimum_required(VERSION 3.3.0) @@ -33,50 +34,43 @@ set_if_empty(MAKEOPTS $ENV{MAKEOPTS}) set_if_empty(DEAL_II_DIR $ENV{DEAL_II_DIR}) # -# A bit of necessary setup if tests are configured as a stand-alone -# project: +# Setup for the case that tests are configured as a stand-alone project: # if(NOT DEFINED DEAL_II_HAVE_TESTS_DIRECTORY) + 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 9.3.0 REQUIRED HINTS ${DEAL_II_DIR}) deal_ii_initialize_cached_variables() project(TESTSUITE CXX) + set(_options "-DDEAL_II_DIR=${DEAL_II_PATH}") + file(WRITE ${CMAKE_BINARY_DIR}/detailed.log "# CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}" ) endif() # -# A bit of necessary setup if tests are included via ADD_SUBDIRECTORY from -# the top-level CMake project: +# Setup for the case that tests are included via ADD_SUBDIRECTORY from the +# top-level CMake project: # if(DEFINED DEAL_II_HAVE_TESTS_DIRECTORY) - message(STATUS "Setting up testsuite") # - # Write minimalistic CTestTestfile.cmake files to CMAKE_BINARY_DIR and - # CMAKE_BINARY_DIR/tests: + # Write minimalistic CTestTestfile.cmake files to CMAKE_BINARY_DIR: # file(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake "subdirs(tests)\n") 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 9.3.0 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 "") @@ -167,7 +161,7 @@ if(DEFINED DEAL_II_HAVE_TESTS_DIRECTORY) ${CMAKE_CURRENT_SOURCE_DIR}/*/*.h ) - add_custom_target(dummy_tests_files + add_custom_target(testsuite SOURCES ${_misc} ) -- 2.39.5