aboutsummaryrefslogtreecommitdiff
path: root/project/cmake/scripts/common
diff options
context:
space:
mode:
authorChristian Fetzer <fetzer.ch@gmail.com>2016-05-21 12:28:06 +0200
committerChristian Fetzer <fetzer.ch@gmail.com>2016-06-01 18:57:52 +0200
commitee443bb43f0e256a27898e7ccbcc3b782c73c1f0 (patch)
tree56bbb14c54088db22448e324ec6e6e7376d742b4 /project/cmake/scripts/common
parent29e2b13cada09c90c0b8bb7de3512abc19e2e774 (diff)
[cmake] Make CMake aware of textfiles that configure the build
The CMake based buildsystem is based on reading the input of textfiles at configure-time. As CMake does not track files that are just accessed using "file(READ)" building does not automatically retrigger a reconfiguration when those files are changes. This commit fixes it by either using configure_file or using the CMAKE_CONFIGURE_DEPENDS variable. This should remove the necessity to manually rerun CMake when files are changed during development. (Due to globbing CMake still has to be rerun when files are added or removed!)
Diffstat (limited to 'project/cmake/scripts/common')
-rw-r--r--project/cmake/scripts/common/AddonHelpers.cmake1
-rw-r--r--project/cmake/scripts/common/HandleDepends.cmake8
-rw-r--r--project/cmake/scripts/common/Macros.cmake2
3 files changed, 10 insertions, 1 deletions
diff --git a/project/cmake/scripts/common/AddonHelpers.cmake b/project/cmake/scripts/common/AddonHelpers.cmake
index 1941da5ddc..a5c9de32c7 100644
--- a/project/cmake/scripts/common/AddonHelpers.cmake
+++ b/project/cmake/scripts/common/AddonHelpers.cmake
@@ -67,6 +67,7 @@ macro (build_addon target prefix libs)
# if there's an addon.xml.in we need to generate the addon.xml
if(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in)
set(PLATFORM ${CORE_SYSTEM_NAME})
file(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file)
diff --git a/project/cmake/scripts/common/HandleDepends.cmake b/project/cmake/scripts/common/HandleDepends.cmake
index 04da91a481..4aca6ba310 100644
--- a/project/cmake/scripts/common/HandleDepends.cmake
+++ b/project/cmake/scripts/common/HandleDepends.cmake
@@ -10,6 +10,7 @@ function(add_addon_depends addon searchpath)
list(APPEND cmake_input_files ${cmake_input_files2})
foreach(file ${cmake_input_files})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${file})
if(NOT (file MATCHES CMakeLists.txt OR
file MATCHES install.txt OR
file MATCHES noinstall.txt OR
@@ -45,6 +46,7 @@ function(add_addon_depends addon searchpath)
# check if there are any library specific flags that need to be passed on
if(EXISTS ${dir}/flags.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags.txt)
file(STRINGS ${dir}/flags.txt extraflags)
separate_arguments(extraflags)
message(STATUS "${id} extraflags: ${extraflags}")
@@ -77,9 +79,10 @@ function(add_addon_depends addon searchpath)
# if there's a CMakeLists.txt use it to prepare the build
set(PATCH_FILE ${BUILD_DIR}/${id}/tmp/patch.cmake)
if(EXISTS ${dir}/CMakeLists.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/CMakeLists.txt)
file(APPEND ${PATCH_FILE}
"file(COPY ${dir}/CMakeLists.txt
- DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
+ DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
endif()
# check if we have patches to apply
@@ -104,6 +107,7 @@ function(add_addon_depends addon searchpath)
endif()
endif()
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${patch})
file(APPEND ${PATCH_FILE}
"execute_process(COMMAND ${PATCH_PROGRAM} -p1 -i \"${patch}\")\n")
endforeach()
@@ -125,6 +129,7 @@ function(add_addon_depends addon searchpath)
# check if there's a deps.txt containing dependencies on other libraries
if(EXISTS ${dir}/deps.txt)
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/deps.txt)
file(STRINGS ${dir}/deps.txt deps)
message(STATUS "${id} depends: ${deps}")
else()
@@ -133,6 +138,7 @@ function(add_addon_depends addon searchpath)
if(CROSS_AUTOCONF AND AUTOCONF_FILES)
foreach(afile ${AUTOCONF_FILES})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${afile})
file(APPEND ${PATCH_FILE}
"message(STATUS \"AUTOCONF: copying ${afile} to ${BUILD_DIR}/${id}/src/${id}\")\n
file(COPY ${afile} DESTINATION ${BUILD_DIR}/${id}/src/${id})\n")
diff --git a/project/cmake/scripts/common/Macros.cmake b/project/cmake/scripts/common/Macros.cmake
index 571662771c..b8dd860f29 100644
--- a/project/cmake/scripts/common/Macros.cmake
+++ b/project/cmake/scripts/common/Macros.cmake
@@ -235,6 +235,7 @@ function(core_file_read_filtered result filepattern)
if(VERBOSE)
message(STATUS "core_file_read_filtered - filename: ${filename}")
endif()
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filename})
file(STRINGS ${filename} fstrings REGEX "^[^#//]")
foreach(fstring ${fstrings})
string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring})
@@ -293,6 +294,7 @@ macro(core_add_optional_subdirs_from_filelist pattern)
if(VERBOSE)
message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}")
endif()
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filename})
file(STRINGS ${filename} fstrings REGEX "^[^#//]")
foreach(line ${fstrings})
string(REPLACE " " ";" line "${line}")