summaryrefslogtreecommitdiffstats
path: root/cmake/UnitTest/generate_test_data.cmake
blob: 9de7410bb7eaf82833fbfd3d0526a2828366a82e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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})