From 12b7a1cb71265839b5d5ea98b58447580762810f Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Mon, 10 Mar 2014 11:32:24 +0000
Subject: [PATCH] [cmake] Copy .input files and grids/ folders to the CMake
 build tree. This implements FS#217.

Reviewed by Christoph.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@12591 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 cmake/modules/DumuxTestMacros.cmake | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/cmake/modules/DumuxTestMacros.cmake b/cmake/modules/DumuxTestMacros.cmake
index aaf6e745e4..cd8d9b860d 100644
--- a/cmake/modules/DumuxTestMacros.cmake
+++ b/cmake/modules/DumuxTestMacros.cmake
@@ -19,8 +19,24 @@ macro(add_dumux_test dumux_test dumux_test_executable dumux_test_executable_sour
     add_directory_test_target(_test_target)
     set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       PROPERTY TEST_INCLUDE_FILE ${CMAKE_CURRENT_BINARY_DIR}/BuildTests.cmake)
+
+    # if present, copy grids folder
+    set(grids_directory ${CMAKE_CURRENT_SOURCE_DIR}/grids)
+    if(EXISTS ${grids_directory} AND IS_DIRECTORY ${grids_directory})
+      file(COPY ${grids_directory} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+    endif()
   endif(NOT TARGET ${potential_test_target})
 
+  # if present, copy input file
+  set(input_file ${CMAKE_CURRENT_SOURCE_DIR}/${dumux_test_executable}.input)
+  if(NOT EXISTS ${input_file})
+    get_filename_component(base_source_name ${dumux_test_executable_source} NAME_WE)
+    set(input_file ${CMAKE_CURRENT_SOURCE_DIR}/${base_source_name}.input)
+  endif()
+  if(EXISTS ${input_file})
+    file(COPY ${input_file} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+  endif()
+
   # add executable
   # check whether executable already exists
   if(NOT TARGET ${dumux_test_executable})
-- 
GitLab