telepathy-qt: Fix wrong version number matching

Alexandr Akulich kaffeine at kemper.freedesktop.org
Mon Oct 14 21:25:17 UTC 2019


Module: telepathy-qt
Branch: master
Commit: 102b1f02cd9854639fb57d689a477cda6180aaf5
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=102b1f02cd9854639fb57d689a477cda6180aaf5

Author: Brandon Hong <brandon.hong at intel.com>
Date:   Fri Sep 20 13:19:27 2019 +0800

Fix wrong version number matching

As the CMake MATCH takes regex parameter, sub-string could unexpectedtly
be matched. QT verseion 5.12.4, for instance, will be matched with not just
for QT5 but also for QT4 as well due to the sub-string '4' which is unexpected.
This patch resolves the issue by constraining version number testing for
Major version numbers only.

Signed-off-by: Brandon Hong <brandon.hong at intel.com>

---

 cmake/modules/FindQt.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmake/modules/FindQt.cmake b/cmake/modules/FindQt.cmake
index 574aef29..f1f5245f 100644
--- a/cmake/modules/FindQt.cmake
+++ b/cmake/modules/FindQt.cmake
@@ -26,10 +26,10 @@ IF(NOT QT5_INSTALLED)
     # now find qmake
     IF(QT_QMAKE_EXECUTABLE)
         EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION)
-        IF(QTVERSION MATCHES "4.*")
+        IF(QTVERSION MATCHES "^4.*")
             SET(QT4_INSTALLED TRUE)
         ENDIF()
-        IF(QTVERSION MATCHES "5.*")
+        IF(QTVERSION MATCHES "^5.*")
             SET(QT5_INSTALLED TRUE)
         ENDIF()
     ENDIF()



More information about the telepathy-commits mailing list