From: Matthias Maier Date: Fri, 11 Nov 2022 23:37:12 +0000 (-0600) Subject: CMake: add a compile_test_executables target X-Git-Tag: v9.5.0-rc1~850^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=028518511f4626662f1427ac7cd94e38603a8510;p=dealii.git 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. --- 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})