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).
This commit is contained in:
Ahmad Samir
2022-06-01 18:03:14 +02:00
parent 28b0d321a3
commit fc9f97df70

View File

@@ -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