From 184b2af3296d22db31b8b10e1ebc8c591304cce5 Mon Sep 17 00:00:00 2001 From: Davide Gerhard Date: Fri, 30 Aug 2019 13:17:57 +0200 Subject: [PATCH] cmake: change install-conf script with configure_file() in this way, If the input file is modified the build system will re-run CMake to re-configure the file and generate the build system again. --- conf/CMakeLists.txt | 2 +- conf/install_conf.cmake | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index 91b9e41..6cdf1f2 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -39,7 +39,7 @@ install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION share/doc/${CMAKE_PROJEC if(NOT WIN32) add_custom_target(install-conf COMMAND ${CMAKE_COMMAND} - -DCMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}" + -DCUSTOM_BINARY_DIR="${CMAKE_BINARY_DIR}" -DCUSTOM_CONF_DIR="${CUSTOM_CONF_DIR}" -DCUSTOM_SCRIPTS_DIR="${CUSTOM_SCRIPTS_DIR}" -DCUSTOM_TELEMETRY_DIR="${CUSTOM_TELEMETRY_DIR}" diff --git a/conf/install_conf.cmake b/conf/install_conf.cmake index 8abfe96..af111a7 100644 --- a/conf/install_conf.cmake +++ b/conf/install_conf.cmake @@ -1,23 +1,23 @@ -if(NOT EXISTS ~/direwolf.conf) - install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/direwolf.conf) + configure_file("${CUSTOM_BINARY_DIR}/direwolf.conf" $ENV{HOME}) endif() -if(NOT EXISTS ~/sdr.conf) - install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/sdr.conf) + configure_file("${CUSTOM_CONF_DIR}/sdr.conf" $ENV{HOME}) endif() -if(NOT EXISTS ~/dw-start.sh) - install(FILES "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/dw-start.sh) + configure_file("${CUSTOM_SCRIPTS_DIR}/dw-start.sh" $ENV{HOME}) endif() -if(NOT EXISTS ~/telem-m0xer-3.txt) - install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/telem-m0xer-3.txt) + configure_file("${CUSTOM_TELEMETRY_DIR}/telem-m0xer-3.txt" $ENV{HOME}) endif() -if(NOT EXISTS ~/telem-balloon.conf) - install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/telem-balloon.conf) + configure_file("${CUSTOM_TELEMETRY_DIR}/telem-balloon.conf" $ENV{HOME}) endif() -if(NOT EXISTS ~/telem-volts.conf) - install(FILES "${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" DESTINATION ~) +if(NOT EXISTS $ENV{HOME}/telem-volts.conf) + configure_file("${CUSTOM_TELEMETRY_DIR}/telem-volts.conf" $ENV{HOME}) endif()