aboutsummaryrefslogtreecommitdiff
path: root/kde-modules/KDEPackageAppTemplates.cmake
diff options
context:
space:
mode:
authorAlexander Lohnau <alexander.lohnau@gmx.de>2020-11-16 16:33:34 +0000
committerAlexander Lohnau <alexander.lohnau@gmx.de>2020-11-16 16:33:34 +0000
commitb9d0276c0f605c950cc739eafbdad9cc3f4ece6a (patch)
tree836e437be6c2dc07acaf68ca267f6c3a11f2b1f1 /kde-modules/KDEPackageAppTemplates.cmake
parent90083fc673db9fa75714ca6b58c2f5d78454e016 (diff)
downloadextra-cmake-modules-b9d0276c0f605c950cc739eafbdad9cc3f4ece6a.tar.gz
extra-cmake-modules-b9d0276c0f605c950cc739eafbdad9cc3f4ece6a.tar.bz2
Fix updating of apptemplate tars
With this MR cmake gets rerun when the dirs/subdirs of the template change. And by setting the `DEPENDS` property of the tar command to this list of the dirs/subdirs of the template we ensure that the command gets executed whenever the files change.
Diffstat (limited to 'kde-modules/KDEPackageAppTemplates.cmake')
-rw-r--r--kde-modules/KDEPackageAppTemplates.cmake31
1 files changed, 14 insertions, 17 deletions
diff --git a/kde-modules/KDEPackageAppTemplates.cmake b/kde-modules/KDEPackageAppTemplates.cmake
index 54fb6fa6..37e989ee 100644
--- a/kde-modules/KDEPackageAppTemplates.cmake
+++ b/kde-modules/KDEPackageAppTemplates.cmake
@@ -84,32 +84,29 @@ function(kde_package_app_templates)
endif()
foreach(_templateName ${ARG_TEMPLATES})
-
get_filename_component(_tmp_file ${_templateName} ABSOLUTE)
get_filename_component(_baseName ${_tmp_file} NAME_WE)
set(_template ${CMAKE_CURRENT_BINARY_DIR}/${_baseName}.tar.bz2)
- file(GLOB _files "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
- set(_deps)
- foreach(_file ${_files})
- get_filename_component(_fileName ${_file} NAME)
- string(COMPARE NOTEQUAL ${_fileName} .kdev_ignore _v1)
- string(REGEX MATCH "\\.svn" _v2 ${_fileName})
- if(WIN32)
- string(REGEX MATCH "_svn" _v3 ${_fileName})
- else(WIN32)
- set(_v3 FALSE)
- endif()
- if (_v1 AND NOT _v2 AND NOT _v3)
- set(_deps ${_deps} ${_file})
- endif ()
- endforeach()
-
+ # CONFIGURE_DEPENDS is only available for cmake >= 3.12
+ if(NOT CMAKE_VERSION VERSION_LESS "3.12.0")
+ # also enlist directories as deps to catch file removals
+ file(GLOB_RECURSE _subdirs_entries LIST_DIRECTORIES true CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
+ else()
+ file(GLOB_RECURSE _subdirs_entries LIST_DIRECTORIES true "${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}/*")
+ # custom code to implement CONFIGURE_DEPENDS
+ foreach(_direntry ${_subdirs_entries})
+ if(IS_DIRECTORY ${_direntry})
+ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_direntry})
+ endif()
+ endforeach()
+ endif()
add_custom_target(${_baseName} ALL DEPENDS ${_template})
add_custom_command(OUTPUT ${_template}
COMMAND ${CMAKE_COMMAND} -E tar "cvfj" ${_template} .
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
+ DEPENDS ${_subdirs_entries}
)