fix KF6 auto-detect on distros without monolithic KF6Config.cmake

This commit is contained in:
Levi Neely 2026-08-07 18:58:42 +02:00
parent a4c6802430
commit 70390097b0
1 changed files with 8 additions and 3 deletions

View File

@ -3,10 +3,15 @@ project(kde-ollie VERSION 0.1.0 LANGUAGES CXX)
option(OLLIE_KF5 "Build against KF5/Qt5 (Plasma 5.27)" OFF)
# Auto-detect: if OLLIE_KF5 not explicitly set, try KF6 first, fall back to KF5
# Auto-detect: if OLLIE_KF5 not explicitly set, try KF6 first, fall back to KF5.
# Note: Gentoo and some distros don't ship a monolithic KF6Config.cmake; check
# individual components directly instead of find_package(KF6 COMPONENTS ...).
if(NOT DEFINED OLLIE_KF5 OR NOT OLLIE_KF5)
find_package(KF6 QUIET COMPONENTS Runner CoreAddons)
if(NOT KF6_FOUND)
find_package(KF6Runner QUIET)
find_package(KF6CoreAddons QUIET)
if(KF6Runner_FOUND AND KF6CoreAddons_FOUND)
set(KF6_FOUND TRUE)
else()
message(STATUS "KF6 not found, falling back to KF5")
set(OLLIE_KF5 ON)
endif()