diff options
author | Aleix Pol <aleixpol@kde.org> | 2016-11-03 17:27:38 +0100 |
---|---|---|
committer | Aleix Pol <aleixpol@kde.org> | 2016-11-07 00:16:31 +0100 |
commit | 187235b7a296bb7e01e51ef8b160ec08d8e7e000 (patch) | |
tree | f717ab86b8de2e23b5de8c134c7515637df01a36 | |
parent | 2b0eae8188230f41fee7390e6afcaca81e3932cd (diff) | |
download | kconfig-187235b7a296bb7e01e51ef8b160ec08d8e7e000.tar.gz kconfig-187235b7a296bb7e01e51ef8b160ec08d8e7e000.tar.bz2 |
Properly parse function keywords
Summary:
Use cmake_parse_arguments() instead of roughly implementing it locally
CCBUG: 371562
Test Plan: recompiled everything, nothing broke
Reviewers: #frameworks, dfaure
Reviewed By: dfaure
Differential Revision: https://phabricator.kde.org/D3251
-rw-r--r-- | KF5ConfigMacros.cmake | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/KF5ConfigMacros.cmake b/KF5ConfigMacros.cmake index 17861a74..c615bb00 100644 --- a/KF5ConfigMacros.cmake +++ b/KF5ConfigMacros.cmake @@ -33,25 +33,15 @@ # SUCH DAMAGE. function (KCONFIG_ADD_KCFG_FILES _sources ) - foreach (_current_ARG ${ARGN}) - if( ${_current_ARG} STREQUAL "GENERATE_MOC" ) - set(_kcfg_generatemoc TRUE) - endif() - - if( ${_current_ARG} STREQUAL "USE_RELATIVE_PATH" ) - set(_kcfg_relativepath TRUE) - endif() - endforeach () + set(options GENERATE_MOC USE_RELATIVE_PATH) + cmake_parse_arguments(ARG "${options}" "" "" ${ARGN}) set(sources) - - foreach (_current_FILE ${ARGN}) - - if(NOT ${_current_FILE} STREQUAL "GENERATE_MOC" AND NOT ${_current_FILE} STREQUAL "USE_RELATIVE_PATH") + foreach (_current_FILE ${ARG_UNPARSED_ARGUMENTS}) get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE) get_filename_component(_abs_PATH ${_tmp_FILE} PATH) - if (_kcfg_relativepath) # Process relative path only if the option was set + if (ARG_USE_RELATIVE_PATH) # Process relative path only if the option was set # Get relative path get_filename_component(_rel_PATH ${_current_FILE} PATH) @@ -99,7 +89,7 @@ function (KCONFIG_ADD_KCFG_FILES _sources ) MAIN_DEPENDENCY ${_tmp_FILE} DEPENDS ${_kcfg_FILE}) - if(_kcfg_generatemoc) + if(ARG_GENERATE_MOC) list(APPEND sources ${_moc_FILE}) qt5_generate_moc(${_header_FILE} ${_moc_FILE}) set_property(SOURCE ${_src_FILE} PROPERTY SKIP_AUTOMOC TRUE) # don't run automoc on this file @@ -107,7 +97,6 @@ function (KCONFIG_ADD_KCFG_FILES _sources ) endif() list(APPEND sources ${_src_FILE} ${_header_FILE}) - endif(NOT ${_current_FILE} STREQUAL "GENERATE_MOC" AND NOT ${_current_FILE} STREQUAL "USE_RELATIVE_PATH") endforeach (_current_FILE) set(${_sources} ${${_sources}} ${sources} PARENT_SCOPE) |