diff options
Diffstat (limited to 'cmake/QtCMakePackageVersionFile.cmake.in')
-rw-r--r-- | cmake/QtCMakePackageVersionFile.cmake.in | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/QtCMakePackageVersionFile.cmake.in b/cmake/QtCMakePackageVersionFile.cmake.in index f668e614c5..d4c30b33ac 100644 --- a/cmake/QtCMakePackageVersionFile.cmake.in +++ b/cmake/QtCMakePackageVersionFile.cmake.in @@ -1,3 +1,6 @@ +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Include the basic version config file to get results of regular version checking. include("${CMAKE_CURRENT_LIST_DIR}/@package_name@ConfigVersionImpl.cmake") @@ -8,7 +11,9 @@ if(QT_NO_PACKAGE_VERSION_CHECK) set(__qt_disable_package_version_check TRUE) endif() +# Extra CMake code begin @extra_code@ +# Extra CMake code end if((NOT PACKAGE_VERSION_COMPATIBLE) OR PACKAGE_VERSION_UNSUITABLE) set(__qt_package_version_incompatible TRUE) @@ -17,9 +22,17 @@ else() endif() if(__qt_disable_package_version_check) + # Don't show the warning needlessly if we know that we're doing an exact search, and the + # version found is not the exactly same. + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT + AND NOT PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING TRUE) + endif() + # Warn if version check is disabled regardless if it's a Qt repo build or user project build. # Allow to opt out of warning. - if(__qt_package_version_incompatible AND NOT QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING) + if(__qt_package_version_incompatible AND NOT QT_NO_PACKAGE_VERSION_INCOMPATIBLE_WARNING + AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) message(WARNING "Package ${PACKAGE_FIND_NAME} with version ${PACKAGE_VERSION} was accepted as " "compatible because QT_NO_PACKAGE_VERSION_CHECK was set to TRUE. There is no guarantee " |