diff options
author | David Redondo <kde@david-redondo.de> | 2020-01-13 15:01:59 +0100 |
---|---|---|
committer | David Redondo <kde@david-redondo.de> | 2020-01-13 20:20:04 +0100 |
commit | 215986603c0f06f99cb5858281ee0796ca9eb5c1 (patch) | |
tree | 7ac70d08fb7a9a8d25e6f16bcb979b2e6f83edf2 | |
parent | ab09df57f64b1d3b93b0368cc8d63467c4f168d1 (diff) | |
download | kconfig-215986603c0f06f99cb5858281ee0796ca9eb5c1.tar.gz kconfig-215986603c0f06f99cb5858281ee0796ca9eb5c1.tar.bz2 |
Allow to also pass a target instead of list of sources to KCONFIG_ADD_KCFG_FILES
Summary: Brings us one step to closer to not needing to create lists of source files
Reviewers: #frameworks, #build_system, apol
Reviewed By: apol
Subscribers: apol, kossebau, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D26626
-rw-r--r-- | KF5ConfigMacros.cmake | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/KF5ConfigMacros.cmake b/KF5ConfigMacros.cmake index 469d9b01..2fe34367 100644 --- a/KF5ConfigMacros.cmake +++ b/KF5ConfigMacros.cmake @@ -1,4 +1,5 @@ # KCONFIG_ADD_KCFG_FILES (SRCS_VAR [GENERATE_MOC] [USE_RELATIVE_PATH] file1.kcfgc ... fileN.kcfgc) +# KCONFIG_ADD_KCFG_FILES (<target> [GENERATE_MOC] [USE_RELATIVE_PATH] file1.kcfgc ... fileN.kcfgc) # Use this to add KDE config compiler files to your application/library. # Use optional GENERATE_MOC to generate moc if you use signals in your kcfg files. # Use optional USE_RELATIVE_PATH to generate the classes in the build following the given @@ -32,7 +33,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -function (KCONFIG_ADD_KCFG_FILES _sources ) +function (KCONFIG_ADD_KCFG_FILES _target_or_source_var) set(options GENERATE_MOC USE_RELATIVE_PATH) cmake_parse_arguments(ARG "${options}" "" "" ${ARGN}) @@ -127,6 +128,10 @@ function (KCONFIG_ADD_KCFG_FILES _sources ) list(APPEND sources ${_src_FILE} ${_header_FILE}) endforeach (_current_FILE) - set(${_sources} ${${_sources}} ${sources} PARENT_SCOPE) + if (TARGET ${_target_or_source_var}) + target_sources(${_target_or_source_var} PRIVATE ${sources}) + else() + set(${_target_or_source_var} ${${_target_or_source_var}} ${sources} PARENT_SCOPE) + endif() endfunction(KCONFIG_ADD_KCFG_FILES) |