diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-06-27 14:32:41 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-06-27 15:36:00 +0200 |
commit | f75e6db05943b868da4d3463c72e2367b02387ed (patch) | |
tree | ec579667d14ba8ba32b2278bbc510384dd671bf3 /cmake/cmake.d | |
parent | ea8a8c3528b5f46e91b571d67e7a4fdaeae49ec2 (diff) |
Recurse over template files to configure them.
Change-Id: I4e18946ac986a0c128b1d6f00185c0fd2200f643
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'cmake/cmake.d')
-rw-r--r-- | cmake/cmake.d/01-variables.cmake (renamed from cmake/cmake.d/02-variables.cmake) | 0 | ||||
-rw-r--r-- | cmake/cmake.d/02-macros.cmake (renamed from cmake/cmake.d/01-macros.cmake) | 28 |
2 files changed, 19 insertions, 9 deletions
diff --git a/cmake/cmake.d/02-variables.cmake b/cmake/cmake.d/01-variables.cmake index 570cb4a..570cb4a 100644 --- a/cmake/cmake.d/02-variables.cmake +++ b/cmake/cmake.d/01-variables.cmake diff --git a/cmake/cmake.d/01-macros.cmake b/cmake/cmake.d/02-macros.cmake index 3024768..0415e54 100644 --- a/cmake/cmake.d/01-macros.cmake +++ b/cmake/cmake.d/02-macros.cmake @@ -37,6 +37,15 @@ macro(defstr name value) add_definitions(-D${name}=${value}) endmacro(defstr) +macro(configure_files_in_dir dir) + file(GLOB filelist "${dir}/*in") + foreach(file ${filelist}) + get_filename_component(filename ${file} NAME) + string(REGEX REPLACE "target" "${RSYNC_TARGET}" destinationfile ${filename}) + configure_file(${file} ${CMAKE_CURRENT_BINARY_DIR}/target/${destinationfile}) + endforeach() +endmacro(configure_files_in_dir) + # Pre-packaging macro(project_targets_populate) # Default Widget default directory @@ -130,8 +139,9 @@ macro(remote_targets_populate) COMMAND exit -1 ) else() - configure_file(${SSH_TEMPLATE_DIR}/start-on-target.in ${CMAKE_CURRENT_BINARY_DIR}/target/start-on-${RSYNC_TARGET}.sh) - configure_file(${GDB_TEMPLATE_DIR}/gdb-on-target.in ${CMAKE_CURRENT_BINARY_DIR}/target/gdb-on-${RSYNC_TARGET}.ini) + + configure_files_in_dir(${SSH_TEMPLATE_DIR}) + configure_files_in_dir(${GDB_TEMPLATE_DIR}) add_custom_target(remote-target-populate DEPENDS populate @@ -186,13 +196,13 @@ macro(wgt_package_build) COMMAND exit -1 ) else() - configure_file(${WGT_TEMPLATE_DIR}/install-wgt-on-target.in ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh) - add_custom_target(widget-target-install - DEPENDS widget - COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh - ) - endif() + configure_files_in_dir(${WGT_TEMPLATE_DIR}) + add_custom_target(widget-target-install + DEPENDS widget + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/target/install-wgt-on-${RSYNC_TARGET}.sh + ) +endif() if(PACKAGE_MESSAGE) add_custom_command(TARGET widget |