]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: add a compile_test_executables target
authorMatthias Maier <tamiko@43-1.org>
Fri, 11 Nov 2022 23:37:12 +0000 (17:37 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 11 Nov 2022 23:37:12 +0000 (17:37 -0600)
This commit adds a top-level compile_test_executables and modifies the
ADD_TEST() macro to let it depend on all executables generated by our
DEAL_II_PICKUP_TESTS() mechanism.

This is mainly intended for user projects and works around the issue
that simultaneous calls to ninja are not reentrant, meaning when
configuring a user project with ninja one is otherwise limited to run
tests in serial.

cmake/macros/macro_deal_ii_add_test.cmake

index 1cd35c2e20ca940b1472ec1dbe12e2147ea2dc1f..43bc117f73ee578059b5f367fcd3f211453d6091 100644 (file)
 
 FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file)
 
+  IF(NOT TARGET compile_test_executables)
+    ADD_CUSTOM_TARGET(compile_test_executables)
+  ENDIF()
+
   IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED)
     MESSAGE(FATAL_ERROR
       "\nDEAL_II_ADD_TEST can only be called in external (test sub-) projects after "
@@ -414,6 +418,8 @@ FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file)
           ${CMAKE_CURRENT_BINARY_DIR}/${_target_short}/interrupt_guard.cc
           )
 
+        ADD_DEPENDENCIES(compile_test_executables ${_target})
+
         SET_TARGET_PROPERTIES(${_target} PROPERTIES OUTPUT_NAME ${_target_short})
 
         DEAL_II_SETUP_TARGET(${_target} ${_build})

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.