From 1bbd8e31af656cbac39e93552405ebdf3792c762 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Wed, 30 Aug 2023 13:30:21 -0400
Subject: [PATCH] cmake: fix check for minimum major/minor version

The current check only fails if the major and minor version are less than the minimum.
This simplifies the check even removing the major version check which is a find requirement already.

Gitlab: #1330
Change-Id: Id066953c50ef4a925713dbd9203ebe7a3a36f4a1
---
 CMakeLists.txt | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86912bc3e..a91d2ed1b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,16 +74,19 @@ set(TESTS_DIR ${PROJECT_SOURCE_DIR}/tests)
 # Here we let find_package(<PackageName>...) try to find Qt 6,
 # If it is found, find_package will succeed, and the CMake variable
 # QT_VERSION_MAJOR will be defined 6.
+set(QT6_MINVER_MINOR 4)
 if(QT6_VER AND QT6_PATH)
   find_package(QT NAMES Qt6 REQUIRED
     PATHS ${QT6_PATH} NO_DEFAULT_PATH)
 else()
+  message(STATUS "Looking for Qt 6" ${CMAKE_PREFIX_PATH})
   find_package(QT NAMES Qt6 REQUIRED)
 endif()
-if (${QT_VERSION_MAJOR} STRLESS 6)
-  if (${QT_VERSION_MINOR} STRLESS 4)
-    message(FATAL_ERROR "Qt 6.4 or higher is required.")
-  endif()
+if (${QT_VERSION_MINOR} GREATER_EQUAL ${QT6_MINVER_MINOR})
+  # Qt version is 6.4 or higher
+  message(STATUS "Found a suitable Qt version ${QT_VERSION}")
+else()
+  message(FATAL_ERROR "Qt 6.4 or higher is required. Found ${QT_VERSION}")
 endif()
 
 if(MSVC)
-- 
GitLab