From fc9f97df709a94d8ff6df2c759b8d626d30c4864 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Wed, 1 Jun 2022 18:03:14 +0200 Subject: [PATCH] Fix build with older ECM versions QT_MAJOR_VERSION is defined automatically by QtVersionOption (since ECM 5.82) which is included by KDEInstallDirs. For older ECM, if QT_MAJOR_VERSION isn't already set, default to 5. There is similar to what's used in polkit-qt-1 (which doesn't depend/use ECM at all). --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82ff527c2..56ca1a09b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,12 @@ include(CheckIncludeFiles) # Allows passing e.g. -DECM_ENABLE_SANITIZERS='address;undefined' to cmake. include(ECMEnableSanitizers) +if(ECM_GLOBAL_FIND_VERSION VERSION_LESS "5.82.0") + if(NOT QT_MAJOR_VERSION) + set(QT_MAJOR_VERSION "5") + endif() +endif() + if(QT_MAJOR_VERSION EQUAL "6") # ECMDeprecationSettings is in ECM since 5.91, this assumes if you're building # with Qt6, you have latest ECM anyway