]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Tests: Clean up top level CMakeLists.txt
authorMatthias Maier <tamiko@43-1.org>
Sat, 10 Dec 2022 06:29:36 +0000 (00:29 -0600)
committerMatthias Maier <tamiko@43-1.org>
Mon, 12 Dec 2022 19:42:00 +0000 (13:42 -0600)
tests/CMakeLists.txt

index cd22872439867599046425b29083ca7323f245ca..5a3728162c63fa0de59532383d86be0d8d0aefcc 100644 (file)
@@ -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}
   )
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.