Skip to content

Commit 0022acc

Browse files
committed
[CMake] Don't copy *.in files from etc to build tree
These files should not leave the source tree.
1 parent 0e7fe86 commit 0022acc

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ add_custom_command(OUTPUT ${stamp_file}
314314

315315

316316
#---Copy files to the build area at build time---------------------------------
317-
set(directories_to_copy etc test icons fonts macros tutorials)
317+
set(directories_to_copy test icons fonts macros tutorials)
318318
if(http)
319319
list(APPEND directories_to_copy js)
320320
endif()
@@ -337,6 +337,25 @@ foreach(dir_to_copy ${directories_to_copy})
337337
DEPENDS ${artifacts_in})
338338
endforeach()
339339

340+
#---Copy etc/* files individually to the build area at build time---------------------------------
341+
# The reason why we don't copy these files with copy_directory as above is that
342+
# we want to exclude a subset of the files.
343+
file(GLOB_RECURSE artifact_files RELATIVE ${CMAKE_SOURCE_DIR} etc/*)
344+
345+
# Exclude the *.in files, just like in the install tree
346+
list(FILTER artifact_files EXCLUDE REGEX "\.(in)$")
347+
348+
foreach(artifact_file ${artifact_files})
349+
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${artifact_file}
350+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/${artifact_file} ${CMAKE_BINARY_DIR}/${artifact_file}
351+
COMMENT "Copying ${CMAKE_SOURCE_DIR}/${artifact_file}"
352+
DEPENDS ${CMAKE_SOURCE_DIR}/${artifact_file})
353+
list(APPEND all_artifacts ${CMAKE_BINARY_DIR}/${artifact_file})
354+
endforeach()
355+
356+
unset(artifact_files)
357+
358+
340359
add_custom_target(move_artifacts DEPENDS ${stamp_file} ${all_artifacts})
341360

342361

0 commit comments

Comments
 (0)