-
Notifications
You must be signed in to change notification settings - Fork 876
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cmake function to copy files, as a single target
Replace nearly-identical blocks of code that defined individual custom targets/custom commands to copy files from source to build dir with the copy_files_to_build_dir function. This reduces the number of build targets and speeds up/cleans up the make output. Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
- Loading branch information
Showing
7 changed files
with
18 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
include(copy_files_to_build_dir) | ||
|
||
# Note: list of rules is created at cmake time, not build time | ||
file(GLOB test_rule_files | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../test/rules/*.yaml") | ||
|
||
foreach(rule_file_path ${test_rule_files}) | ||
get_filename_component(rule_file ${rule_file_path} NAME) | ||
add_custom_target(docker-local-rule-${rule_file} ALL | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${rule_file}) | ||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${rule_file} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${rule_file_path} ${CMAKE_CURRENT_BINARY_DIR}/${rule_file} | ||
DEPENDS ${rule_file_path}) | ||
endforeach() | ||
|
||
copy_files_to_build_dir("${test_rule_files}" docker-local-rules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
include(copy_files_to_build_dir) | ||
|
||
# Note: list of traces is created at cmake time, not build time | ||
file(GLOB test_trace_files | ||
"${CMAKE_CURRENT_SOURCE_DIR}/../../../test/trace_files/*.scap") | ||
|
||
foreach(trace_file_path ${test_trace_files}) | ||
get_filename_component(trace_file ${trace_file_path} NAME) | ||
add_custom_target(docker-local-trace-${trace_file} ALL | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${trace_file}) | ||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${trace_file_path} ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
DEPENDS ${trace_file_path}) | ||
endforeach() | ||
|
||
copy_files_to_build_dir("${test_trace_files}" docker-local-traces) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
add_subdirectory(trace_files) | ||
|
||
add_custom_target(test-trace-files ALL) | ||
add_dependencies(test-trace-files trace-files-base-scap trace-files-psp trace-files-k8s-audit trace-files-plugins) | ||
|
||
add_subdirectory(plugins) | ||
add_subdirectory(confs/plugins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
include(copy_files_to_build_dir) | ||
|
||
# Note: list of traces is created at cmake time, not build time | ||
file(GLOB test_trace_files | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.json") | ||
|
||
foreach(trace_file_path ${test_trace_files}) | ||
get_filename_component(trace_file ${trace_file_path} NAME) | ||
add_custom_target(test-trace-${trace_file} ALL | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${trace_file}) | ||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${trace_file_path} ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
DEPENDS ${trace_file_path}) | ||
list(APPEND K8S_AUDIT_TRACE_FILES_TARGETS test-trace-${trace_file}) | ||
endforeach() | ||
|
||
add_custom_target(trace-files-k8s-audit ALL) | ||
add_dependencies(trace-files-k8s-audit ${K8S_AUDIT_TRACE_FILES_TARGETS}) | ||
copy_files_to_build_dir("${test_trace_files}" k8s-audit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
include(copy_files_to_build_dir) | ||
|
||
# Note: list of traces is created at cmake time, not build time | ||
file(GLOB test_trace_files | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.json") | ||
|
||
foreach(trace_file_path ${test_trace_files}) | ||
get_filename_component(trace_file ${trace_file_path} NAME) | ||
add_custom_target(test-trace-${trace_file} ALL | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${trace_file}) | ||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${trace_file_path} ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
DEPENDS ${trace_file_path}) | ||
list(APPEND PLUGINS_TRACE_FILES_TARGETS test-trace-${trace_file}) | ||
endforeach() | ||
|
||
add_custom_target(trace-files-plugins ALL) | ||
add_dependencies(trace-files-plugins ${PLUGINS_TRACE_FILES_TARGETS}) | ||
copy_files_to_build_dir("${test_trace_files}" plugins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
include(copy_files_to_build_dir) | ||
|
||
# Note: list of traces is created at cmake time, not build time | ||
file(GLOB test_trace_files | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.json" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/*.scap") | ||
|
||
foreach(trace_file_path ${test_trace_files}) | ||
get_filename_component(trace_file ${trace_file_path} NAME) | ||
add_custom_target(test-trace-${trace_file} ALL | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${trace_file}) | ||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${trace_file_path} ${CMAKE_CURRENT_BINARY_DIR}/${trace_file} | ||
DEPENDS ${trace_file_path}) | ||
list(APPEND PSP_TRACE_FILES_TARGETS test-trace-${trace_file}) | ||
endforeach() | ||
|
||
add_custom_target(trace-files-psp ALL) | ||
add_dependencies(trace-files-psp ${PSP_TRACE_FILES_TARGETS}) | ||
copy_files_to_build_dir("${test_trace_files}" psp) |