]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Bugfix: do not invoke diff during configure
authorMatthias Maier <tamiko@43-1.org>
Mon, 3 Jul 2023 03:24:35 +0000 (22:24 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 3 Jul 2023 04:03:19 +0000 (23:03 -0500)
Instead, update the deal_ii_add_test() macro to allow defining a test
with generated source files.

cmake/macros/macro_deal_ii_add_test.cmake
tests/examples/CMakeLists.txt.in

index f7f7e6d1ccf5ab85828626e5b8c12e951d413a4c..02b525109fa1ac621dbe2fb0ed3b728eccc6c8a0 100644 (file)
@@ -289,13 +289,21 @@ function(deal_ii_add_test _category _test_name _comparison_file)
   list(LENGTH _source_file _number)
   if(NOT _number EQUAL 1)
     if(_number EQUAL 0)
-      message(FATAL_ERROR "\n${_comparison_file}:\n"
-        "A comparison file (ending in .output or .run-only) has been "
-        "picked up but no suitable source file or parameter file was "
-        "found. Please provide exactly one of the following.\n"
-        "A source file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.c[cu]\",\n"
-        "or a parameter file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.(prm|json)[.in]\".\n"
-        )
+      #
+      # None of the candidates above exist. Check whether a
+      # ${_test_name}.cc file gets generated during the build process:
+      set(_source_file "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.cc")
+      get_property(_generated SOURCE "${_source_file}" PROPERTY GENERATED)
+      if(NOT ${_generated})
+        message(FATAL_ERROR "\n${_comparison_file}:\n"
+          "A comparison file (ending in .output or .run-only) has been "
+          "picked up but no suitable source file, generated source file, or "
+          "parameter file was found. Please provide exactly one of the following.\n"
+          "A source file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.c[cu]\",\n"
+          "or a parameter file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.(prm|json)[.in]\".\n"
+          )
+      endif()
+
     else()
       string(REPLACE ";" "\n" _source_file "${_source_file}")
       message(FATAL_ERROR "\n${_comparison_file}:\n"
index 1bc0c80d00e31a285d9be7aeb5eb757bdc63ea3a..bafa43e7b86cd50c39bb6be44ab16d2dcf36e27e 100644 (file)
@@ -20,10 +20,6 @@ foreach(_diff_file ${_diff_files})
     COMMENT "Patching ${_output_file}"
     )
 
-  execute_process(
-    COMMAND patch ${_source_file} ${_diff_file} -o ${_output_file}
-    )
-
   # Create symbolic links to the output files:
   file(GLOB _output_files "${_base_directory}/${_step}*.output*")
   foreach(_file ${_output_files})

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.