summaryrefslogtreecommitdiffstats
path: root/cmake/UnitTest/generate_test_data.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/UnitTest/generate_test_data.cmake')
-rw-r--r--cmake/UnitTest/generate_test_data.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/UnitTest/generate_test_data.cmake b/cmake/UnitTest/generate_test_data.cmake
new file mode 100644
index 00000000..9de7410b
--- /dev/null
+++ b/cmake/UnitTest/generate_test_data.cmake
@@ -0,0 +1,26 @@
+# Copy files from source directory to destination directory, substituting any
+# variables. Create destination directory if it does not exist.
+
+function(configure_files srcDir destDir)
+ message(STATUS "Configuring directory ${destDir} from ${srcDir}")
+ make_directory(${destDir})
+
+ file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*)
+ foreach(templateFile ${templateFiles})
+ set(srcTemplatePath ${srcDir}/${templateFile})
+ if(NOT IS_DIRECTORY ${srcTemplatePath})
+ message(STATUS "Configuring file ${templateFile}")
+ configure_file(
+ ${srcTemplatePath}
+ ${destDir}/${templateFile}
+ @ONLY
+ NEWLINE_STYLE LF
+ )
+ else()
+ message(STATUS "Recursing? ${srcTemplatePath}")
+ configure_files("${srcTemplatePath}" "${destDir}/${templateFile}")
+ endif()
+ endforeach()
+endfunction()
+
+configure_files(${SOURCE} ${DESTINATION}) \ No newline at end of file