Skip to content

Commit

Permalink
Merge pull request #9876 from fetzerch/cmake_textfiles
Browse files Browse the repository at this point in the history
[cmake] Make CMake aware of textfiles that configure the build
  • Loading branch information
fetzerch committed Jun 1, 2016
2 parents 97039b4 + ee443bb commit 8803a66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions project/cmake/scripts/common/AddonHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion project/cmake/scripts/common/HandleDepends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions project/cmake/scripts/common/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 8803a66

Please sign in to comment.