CMake: re-jig required/optional reporting again

- Don't use the ${kfname} package itself, use it as a prefix for
  specific components of that package (e.g. ${kfname}CoreAddons)
- Use TYPE to indicate required packages, rather than using
  REQUIRED in the find_package call, to more-helpfully collect
  missing requirements.
This commit is contained in:
Adriaan de Groot 2023-09-10 21:32:48 +02:00
parent 8925c34ff7
commit d04f17bb72

View File

@ -317,12 +317,22 @@ if(WITH_QML)
endif() endif()
# Note that some modules need more Qt modules, optionally. # Note that some modules need more Qt modules, optionally.
find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED) find_package(YAMLCPP ${YAMLCPP_VERSION})
set_package_properties(
YAMLCPP
PROPERTIES
TYPE REQUIRED
DESCRIPTION "YAML parser for C++"
PURPOSE "Parsing of configuration files"
)
find_package(Polkit${qtname}-1)
if(INSTALL_POLKIT) if(INSTALL_POLKIT)
find_package(Polkit${qtname}-1 REQUIRED) set_package_properties(
else() Polkit${qtname}-1
# Find it anyway, for dependencies-reporting PROPERTIES
find_package(Polkit${qtname}-1) TYPE REQUIRED
)
endif() endif()
set_package_properties( set_package_properties(
Polkit${qtname}-1 Polkit${qtname}-1
@ -348,15 +358,38 @@ if(ECM_FOUND)
include(KDEInstallDirs) include(KDEInstallDirs)
endif() endif()
find_package(${kfname}CoreAddons ${KF_VERSION} QUIET REQUIRED) find_package(${kfname}CoreAddons ${KF_VERSION} QUIET)
set_package_properties(
${kfname}CoreAddons
PROPERTIES
TYPE REQUIRED
DESCRIPTION "KDE Framework CoreAddons"
URL "https://api.kde.org/frameworks/"
PURPOSE "Essential Framework for AboutData and Macros"
)
# After this point, there should be no REQUIRED find_packages, # After this point, there should be no REQUIRED find_packages,
# since we want tidy reporting of optional dependencies. # since we want tidy reporting of optional dependencies.
feature_summary(
WHAT REQUIRED_PACKAGES_NOT_FOUND
FATAL_ON_MISSING_REQUIRED_PACKAGES
DESCRIPTION "The following REQUIRED packages were not found:"
QUIET_ON_EMPTY
)
# #
# OPTIONAL DEPENDENCIES # OPTIONAL DEPENDENCIES
# #
# First, set KF back to optional so that any missing components don't trip us up. # First, set KF back to optional so that any missing components don't trip us up.
find_package(${kfname}Crash ${KF_VERSION} QUIET) find_package(${kfname}Crash ${KF_VERSION} QUIET)
set_package_properties(
${kfname}Crash
PROPERTIES
TYPE OPTIONAL
DESCRIPTION "KDE Framework Crash"
URL "https://api.kde.org/frameworks/"
PURPOSE "Framework for sending Crash Dumps"
)
if(NOT TARGET ${kfname}::Crash) if(NOT TARGET ${kfname}::Crash)
if(BUILD_CRASH_REPORTING) if(BUILD_CRASH_REPORTING)