plasma-framework/KF5PlasmaConfig.cmake.in
Friedrich W. H. Kossebau c03c2d5265 Help automoc to find metadata JSON files referenced in the code
Summary:
automoc by itself can only detect metadata files referenced by direct
usage of the Q_PLUGIN_METADATA macro. It does not do any C++ preprocessor
evaluation. Instead it needs to be helped with regexp-based filter rules
for detecting any names of files used as additional moc input.
See docs for AUTOMOC_DEPEND_FILTERS for further details.

In the near future all the boilerplate code should be replaced with a yet to
be designed ECM macro. For now explicit code is used to collect use cases
for the macro and still to fix the issue already.

Test Plan:
Changing a JSON file (or for those generated from .desktop files
changing that one) and running make results in the related *.moc file
being regenerated and the related object file being recompiled.
qtplugininfo shows that the created plugin binary has up-to-date JSON
content.

Reviewers: #frameworks, #build_system, apol

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D10732
2018-02-25 22:23:05 +01:00

46 lines
1.9 KiB
CMake

@PACKAGE_INIT@
# Any changes in this ".cmake" file will be overwritten by CMake, the source is the ".cmake.in" file.
include("${CMAKE_CURRENT_LIST_DIR}/KF5PlasmaTargets.cmake")
@PACKAGE_INCLUDE_QCHTARGETS@
set(Plasma_INSTALL_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(Plasma_LIBRARIES KF5::Plasma)
set(PLASMA_DATAENGINES_PLUGINDIR ${KDE_INSTALL_PLUGINDIR}/plasma/dataengine)
set(PLASMA_PLASMOIDS_PLUGINDIR ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
set(PLASMA_SCRIPTENGINES_PLUGINDIR ${KDE_INSTALL_PLUGINDIR}/plasma/scriptengines)
set(PLASMA_CONTAINMENTACTIONS_PLUGINDIR ${KDE_INSTALL_PLUGINDIR}/plasma/containmentactions)
include(CMakeFindDependencyMacro)
find_dependency(Qt5Gui "@REQUIRED_QT_VERSION@")
find_dependency(KF5Package "@KF5_DEP_VERSION@")
find_dependency(KF5Service "@KF5_DEP_VERSION@")
find_dependency(KF5WindowSystem "@KF5_DEP_VERSION@")
if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
# CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
# 3.10+ lets us provide more macro names that require automoc.
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES @Plasma_AUTOMOC_MACRO_NAMES@)
endif()
if(NOT CMAKE_VERSION VERSION_LESS "3.9.0")
foreach(macro_name @Plasma_AUTOMOC_MACRO_NAMES_WITH_JSON_ARG2@)
# tell automoc how to find names of plugin metadata files
list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
"${macro_name}"
"[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[ \t\n]*\"([^\"]+)\""
)
endforeach()
foreach(macro_name @Plasma_AUTOMOC_MACRO_NAMES_WITH_JSON_ARG3@)
# tell automoc how to find names of plugin metadata files
list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
"${macro_name}"
"[\n^][ \t]*${macro_name}[ \t\n]*\\([^,]*,[^,]*,[ \t\n]*\"([^\"]+)\""
)
endforeach()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/KF5PlasmaMacros.cmake")