CMake: massage finding-of-things to be less demanding

1- Need to be careful switching dependencies from REQUIRED to OPTIONAL
2- Don't do ECM REQUIRED all over the place
3- Workaround neon CI not having KCrash (which translated to KF5 not
   found, which translated to a missing REQUIRED dependency, see 1).
This commit is contained in:
Adriaan de Groot 2023-09-10 21:08:34 +02:00
parent 63b7ecb97e
commit 8925c34ff7
4 changed files with 4 additions and 10 deletions

View File

@ -334,7 +334,7 @@ set_package_properties(
# Find ECM once, and add it to the module search path; Calamares # Find ECM once, and add it to the module search path; Calamares
# modules that need ECM can do # modules that need ECM can do
# find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE), # if(ECM_FOUND)
# no need to mess with the module path after. # no need to mess with the module path after.
find_package(ECM ${ECM_VERSION} NO_MODULE) find_package(ECM ${ECM_VERSION} NO_MODULE)
if(ECM_FOUND) if(ECM_FOUND)
@ -348,7 +348,7 @@ if(ECM_FOUND)
include(KDEInstallDirs) include(KDEInstallDirs)
endif() endif()
find_package(${kfname} ${KF_VERSION} QUIET REQUIRED COMPONENTS CoreAddons) find_package(${kfname}CoreAddons ${KF_VERSION} QUIET REQUIRED)
# 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.
@ -356,7 +356,7 @@ find_package(${kfname} ${KF_VERSION} QUIET REQUIRED COMPONENTS CoreAddons)
# 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} ${KF_VERSION} QUIET COMPONENTS CoreAddons Crash) find_package(${kfname}Crash ${KF_VERSION} QUIET)
if(NOT TARGET ${kfname}::Crash) if(NOT TARGET ${kfname}::Crash)
if(BUILD_CRASH_REPORTING) if(BUILD_CRASH_REPORTING)
@ -568,7 +568,7 @@ add_feature_info(KCrash ${BUILD_CRASH_REPORTING} "Crash dumps via KCrash")
### Post-source configuration ### Post-source configuration
# #
# #
find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS CoreAddons Crash) find_package(${kfname} ${KF_VERSION} QUIET COMPONENTS CoreAddons)
### CMake infrastructure installation ### CMake infrastructure installation
# #

View File

@ -8,8 +8,6 @@ if(WITH_QT6)
return() return()
endif() endif()
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
set(kf5_ver 5.41) set(kf5_ver 5.41)
find_package(KF5Service ${kf5_ver}) find_package(KF5Service ${kf5_ver})

View File

@ -41,8 +41,6 @@ if(DEBUG_PARTITION_SKIP)
list(APPEND _partition_defs DEBUG_PARTITION_SKIP) list(APPEND _partition_defs DEBUG_PARTITION_SKIP)
endif() endif()
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
include(KPMcoreHelper) include(KPMcoreHelper)
if(KPMcore_FOUND) if(KPMcore_FOUND)

View File

@ -8,8 +8,6 @@ if(WITH_QT6)
return() return()
endif() endif()
find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
# Requires a sufficiently recent Plasma framework, but also # Requires a sufficiently recent Plasma framework, but also
# needs a runtime support component (which we don't test for). # needs a runtime support component (which we don't test for).