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.
This commit is contained in:
Davide Gerhard 2019-08-30 13:17:57 +02:00
parent 0e5049c08a
commit 184b2af329
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
2 changed files with 13 additions and 13 deletions

View File

@ -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}"

View File

@ -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()