aboutsummaryrefslogtreecommitdiff
path: root/KF5ConfigMacros.cmake
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2019-03-06 13:43:56 +0100
committerFriedrich W. H. Kossebau <kossebau@kde.org>2019-03-15 06:55:13 +0100
commita3ed87ca7808363d8752f919617f88010ebf46b3 (patch)
tree8499bdc6b25490d84e71b4bee3f2be5b159df6f6 /KF5ConfigMacros.cmake
parent516f558742dfa8da7a5e6def39309516d703bc1b (diff)
downloadkconfig-a3ed87ca7808363d8752f919617f88010ebf46b3.tar.gz
kconfig-a3ed87ca7808363d8752f919617f88010ebf46b3.tar.bz2
kconfig_compiler: new kcfgc args HeaderExtension & SourceExtension
Summary: When using kconfig_compiler generated sources in projects where the used file extensions for C++ files are not ".h" and/or ".cpp", the include for the generated header looks a bit alien to the project, as well as the generated source file if one looks closer at it. This code adds new optional flags HeaderExtension & SourceExtension which can be used to control the file extensions used for the generated files. Test Plan: All unit tests and the new test_fileextensions pass, existing projects using kcfg without & with the new flags build fine. Reviewers: #frameworks, apol Reviewed By: apol Subscribers: apol, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D19565
Diffstat (limited to 'KF5ConfigMacros.cmake')
-rw-r--r--KF5ConfigMacros.cmake19
1 files changed, 17 insertions, 2 deletions
diff --git a/KF5ConfigMacros.cmake b/KF5ConfigMacros.cmake
index 65af42a6..469d9b01 100644
--- a/KF5ConfigMacros.cmake
+++ b/KF5ConfigMacros.cmake
@@ -75,8 +75,23 @@ function (KCONFIG_ADD_KCFG_FILES _sources )
set(_kcfg_FILENAME "${_basename}.kcfg")
endif()
endif()
- set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
- set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
+
+ string(REGEX MATCH "HeaderExtension=([^\n]+)\n" "" "${_contents}")
+ if(CMAKE_MATCH_1)
+ set(_kcfg_header_EXT "${CMAKE_MATCH_1}")
+ else()
+ set(_kcfg_header_EXT "h")
+ endif()
+
+ string(REGEX MATCH "SourceExtension=([^\n]+)\n" "" "${_contents}")
+ if(CMAKE_MATCH_1)
+ set(_kcfg_src_EXT "${CMAKE_MATCH_1}")
+ else()
+ set(_kcfg_src_EXT "cpp")
+ endif()
+
+ set(_src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.${_kcfg_src_EXT})
+ set(_header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.${_kcfg_header_EXT})
set(_moc_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
set(_kcfg_FILE ${_abs_PATH}/${_kcfg_FILENAME})
# Maybe the .kcfg is a generated file?