diff --git a/CMakeLists.txt b/CMakeLists.txt index 925e662..b01d226 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +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 +if(NOT DEFINED OLLIE_KF5 OR NOT OLLIE_KF5) + find_package(KF6 QUIET COMPONENTS Runner CoreAddons) + if(NOT KF6_FOUND) + message(STATUS "KF6 not found, falling back to KF5") + set(OLLIE_KF5 ON) + endif() +endif() + # Suppress CMP0160 warnings from KF5 cmake files (read-only IMPORTED property) if(OLLIE_KF5) cmake_policy(SET CMP0160 OLD)