From 028518511f4626662f1427ac7cd94e38603a8510 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 11 Nov 2022 17:37:12 -0600 Subject: [PATCH] CMake: add a compile_test_executables target 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake index 1cd35c2e20..43bc117f73 100644 --- a/cmake/macros/macro_deal_ii_add_test.cmake +++ b/cmake/macros/macro_deal_ii_add_test.cmake @@ -105,6 +105,10 @@ 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}) -- 2.39.5