From: bentoo overlay
Subject: [PATCH] Make enabled KDE features REQUIRED

Rebase of ::gentoo's digikam-8.4.0-cmake.patch (Andreas Sturmlechner) onto
9.2.0, which dropped Qt5: only the KDE Frameworks half still applies. When
ENABLE_KFILEMETADATASUPPORT or ENABLE_AKONADICONTACTSUPPORT is on, its
libraries are REQUIRED instead of the option being switched off silently.
---
--- a/core/cmake/rules/RulesKDEFramework.cmake
+++ b/core/cmake/rules/RulesKDEFramework.cmake
@@ -27,30 +27,14 @@
 )
 
 if(ENABLE_KFILEMETADATASUPPORT)
-
-    find_package(KF6 ${KF6_MIN_VERSION} QUIET
-                                        OPTIONAL_COMPONENTS
-                                        FileMetaData            # For Plasma desktop file indexer support.
-    )
-
+    # For Plasma desktop file indexer support.
+    find_package(KF6FileMetaData ${KF6_MIN_VERSION} REQUIRED)
 endif()
 
 if(ENABLE_AKONADICONTACTSUPPORT)
-
-    find_package(KPim6 ${KF6_MIN_VERSION} QUIET
-                                          OPTIONAL_COMPONENTS
-                                          Akonadi
-                                          AkonadiContactCore  # For KDE Mail Contacts support.
-    )
-
-    find_package(KF6 ${KF6_MIN_VERSION} QUIET
-                                        OPTIONAL_COMPONENTS
-                                        Contacts            # API for contacts/address book data.
-    )
-
-    find_package(KPim6Akonadi ${KF6_MIN_VERSION} QUIET)
-    find_package(KPim6AkonadiContactCore ${KF6_MIN_VERSION} QUIET)
-
+    find_package(KF6Contacts ${KF6_MIN_VERSION} REQUIRED) # API for contacts/address book data.
+    find_package(KPim6Akonadi ${KF6_MIN_VERSION} REQUIRED)
+    find_package(KPim6AkonadiContactCore ${KF6_MIN_VERSION} REQUIRED) # For KDE Mail Contacts support.
 endif()
 
 find_package(KSaneWidgets6)
@@ -62,19 +46,6 @@
 
 set(HAVE_KCALENDAR_QDATETIME TRUE)
 
-if(ENABLE_AKONADICONTACTSUPPORT AND
-   (NOT (KPim6AkonadiContact_FOUND OR KPim6AkonadiContactCore_FOUND) OR NOT KF6Contacts_FOUND))
-
-    set(ENABLE_AKONADICONTACTSUPPORT OFF)
-
-endif()
-
-if(ENABLE_KFILEMETADATASUPPORT AND NOT KF6FileMetaData_FOUND)
-
-    set(ENABLE_KFILEMETADATASUPPORT OFF)
-
-endif()
-
 # Check if KIO have been compiled with KIOWidgets. digiKam only needs this one.
 
 if(ENABLE_KIO)
