From 04c71a3772a95770256f4ce2d6065507459df603 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 30 Jun 2023 22:24:40 -0500 Subject: [PATCH] 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. --- cmake/macros/macro_deal_ii_add_test.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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." -- 2.39.5