]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: add_test() remove code duplication
authorMatthias Maier <tamiko@43-1.org>
Tue, 24 Jan 2023 16:56:35 +0000 (10:56 -0600)
committerMatthias Maier <tamiko@43-1.org>
Wed, 25 Jan 2023 23:26:29 +0000 (17:26 -0600)
cmake/macros/macro_deal_ii_add_test.cmake

index 87cdd40288b21da2fd9209984055f7b4a4e5b95b..1e88c20434fdbabbf80f44e8c0071c261995d904 100644 (file)
@@ -574,37 +574,24 @@ function(deal_ii_add_test _category _test_name _comparison_file)
       # And finally define the test:
       #
 
+      add_test(NAME ${_test_full}
+        COMMAND ${CMAKE_COMMAND}
+          -DTRGT=${_test_target}
+          -DTEST=${_test_full}
+          -DEXPECT=${_expect}
+          -DBINARY_DIR=${CMAKE_BINARY_DIR}
+          -P ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.cmake
+        WORKING_DIRECTORY ${_test_directory}
+        )
+      set_tests_properties(${_test_full} PROPERTIES
+        LABEL "${_category}"
+        TIMEOUT ${TEST_TIME_LIMIT}
+        )
+
       if(_shared_target)
-        add_test(NAME ${_test_full}
-          COMMAND ${CMAKE_COMMAND}
-            -DTRGT=${_test_target}
-            -DTEST=${_test_full}
-            -DEXPECT=${_expect}
-            -DBINARY_DIR=${CMAKE_BINARY_DIR}
-            -P ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.cmake
-          WORKING_DIRECTORY ${_test_directory}
-          )
         set_tests_properties(${_test_full} PROPERTIES
-          LABEL "${_category}"
-          TIMEOUT ${TEST_TIME_LIMIT}
           FIXTURES_REQUIRED ${_test_executable_full}
           )
-
-      else()
-
-        add_test(NAME ${_test_full}
-          COMMAND ${CMAKE_COMMAND}
-            -DTRGT=${_test_target}
-            -DTEST=${_test_full}
-            -DEXPECT=${_expect}
-            -DBINARY_DIR=${CMAKE_BINARY_DIR}
-            -P ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.cmake
-          WORKING_DIRECTORY ${_test_directory}
-          )
-        set_tests_properties(${_test_full} PROPERTIES
-          LABEL "${_category}"
-          TIMEOUT ${TEST_TIME_LIMIT}
-          )
       endif()
 
       if(_exclusive)

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.