From 34a4b39cf3ab0c7f83babe94ac3c768d5d9801d9 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 24 Aug 2025 10:59:32 +0200 Subject: FindQt3: Add Qt3_VERSION This deprecates the QT_VERSION_STRING result variable. The QT_VERSION_STRING was probably meant to be set also by FindQt4 module (for the deprecated FindQt) but at the time of writing isn't implemented therefore replaced in the test. Issue: #27088 --- Help/release/dev/find-modules.rst | 3 +++ Modules/FindQt3.cmake | 26 ++++++++++++++++++++++---- Tests/CMakeOnly/CMakeLists.txt | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Help/release/dev/find-modules.rst b/Help/release/dev/find-modules.rst index b6a2c35..7697c6a 100644 --- a/Help/release/dev/find-modules.rst +++ b/Help/release/dev/find-modules.rst @@ -84,6 +84,9 @@ Find Modules result variable. The ``PostgreSQL_VERSION_STRING`` result variable is deprecated. +* The :module:`FindQt3` module now provides a ``Qt3_VERSION`` result + variable. The ``QT_VERSION_STRING`` result variable is deprecated. + * The :module:`FindSDL_gfx`, :module:`FindSDL_image`, :module:`FindSDL_mixer`, :module:`FindSDL_net`, :module:`FindSDL_sound`, and :module:`FindSDL_ttf` modules now provide their respective ``_VERSION`` result diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index ae4bb93..9fc3ee3 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -24,14 +24,20 @@ Result Variables This module defines the following variables: ``Qt3_FOUND`` - Boolean indicating whether Qt3 has been found. + Boolean indicating whether (the requested version of) Qt3 has been found. + ``QT_FOUND`` Boolean indicating whether Qt3 has been found. This variable is for compatibility with other Qt find modules. -``QT_VERSION_STRING`` + +``Qt3_VERSION`` + .. versionadded:: 4.2 + The version of Qt3 that was found. + ``QT_LIBRARIES`` Libraries needed to link against for using Qt3. + ``QT_DEFINITIONS`` A list of compile definitions to use when compiling code that uses Qt3. @@ -61,6 +67,17 @@ Hints To search for the multithreaded version of Qt3, set this variable to ``TRUE`` before looking for Qt3. +Deprecated Variables +^^^^^^^^^^^^^^^^^^^^ + +The following variables are provided for backward compatibility: + +``QT_VERSION_STRING`` + .. deprecated:: 4.2 + Use ``Qt3_VERSION``, which has the same value. + + The version of Qt3 that was found. + Examples ^^^^^^^^ @@ -138,7 +155,8 @@ if(QT_INCLUDE_DIR) # Under windows the qt library (MSVC) has the format qt-mtXYZ where XYZ is the # version X.Y.Z, so we need to remove the dots from version string(REGEX REPLACE "\\." "" qt_version_str_lib "${qt_version_str}") - set(QT_VERSION_STRING "${qt_version_str}") + set(Qt3_VERSION "${qt_version_str}") + set(QT_VERSION_STRING "${Qt3_VERSION}") endif() file(GLOB GLOB_PATHS_LIB /usr/lib/qt-3*/lib/) @@ -265,7 +283,7 @@ if (CMAKE_FIND_PACKAGE_NAME STREQUAL "Qt") endif () find_package_handle_standard_args(Qt3 REQUIRED_VARS QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE - VERSION_VAR QT_VERSION_STRING) + VERSION_VAR Qt3_VERSION) unset(FPHSA_NAME_MISMATCHED) set(QT_FOUND ${QT3_FOUND} ) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 4ceb768..03f7c5c 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -94,4 +94,4 @@ endfunction() add_major_test(PythonLibs VERSIONS 2 3 VERSION_VAR PYTHONLIBS_VERSION_STRING) add_major_test(PythonInterp NOLANG VERSIONS 3 VERSION_VAR PYTHON_VERSION_STRING) -add_major_test(Qt VERSIONS 3 4 VERSION_VAR QT_VERSION_STRING) +add_major_test(Qt VERSIONS 3 4 VERSION_VAR Qt3_VERSION) -- cgit v0.12