From: Matthias Maier Date: Sat, 1 Jul 2023 03:24:40 +0000 (-0500) Subject: CMake: deal_ii_add_test() count how many tests we are setting up X-Git-Tag: relicensing~824^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04c71a3772a95770256f4ce2d6065507459df603;p=dealii.git CMake: deal_ii_add_test() count how many tests we are setting up This sets the variables _number_of_tests _number_of_test_dependencies in the parent scope from which deal_ii_add_test() was invoked. --- diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake index 9646eac8c0..f7f7e6d1cc 100644 --- a/cmake/macros/macro_deal_ii_add_test.cmake +++ b/cmake/macros/macro_deal_ii_add_test.cmake @@ -324,6 +324,14 @@ function(deal_ii_add_test _category _test_name _comparison_file) endif() foreach(_build ${_build_types}) + # + # Increment the _number_of_tests counter by one in the parent scope. + # Note that the variable can be undefined initially. In this case we + # simply store "1" in the first iteration. + # + math(EXPR _number_of_tests "${_number_of_tests} + 1") + set(_number_of_tests "${_number_of_tests}" PARENT_SCOPE) + # # Obey "debug" and "release" keywords in the output file: # @@ -483,6 +491,17 @@ function(deal_ii_add_test _category _test_name _comparison_file) # if(_shared_target AND NOT TARGET ${_test_executable_target}) + # + # Increment the _number_of_test_dependencies counter by one in the + # parent scope. Test dependencies are all tests where we have split + # out compiling and linking of an executable into a separate + # "test_dependency/" test. Note that the variable can be undefined + # initially. In this case we simply store "1" in the first + # iteration. + # + math(EXPR _number_of_test_dependencies "${_number_of_test_dependencies} + 1") + set(_number_of_test_dependencies "${_number_of_test_dependencies}" PARENT_SCOPE) + add_custom_target(${_test_executable_target} COMMAND echo "${_test_executable_full}: BUILD successful." COMMAND echo "${_test_executable_full}: RUN skipped."