From 215986603c0f06f99cb5858281ee0796ca9eb5c1 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Mon, 13 Jan 2020 15:01:59 +0100 Subject: 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 --- KF5ConfigMacros.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'KF5ConfigMacros.cmake') 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 ( [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) -- cgit v1.2.1