qtbase/cmake/QtModuleConfigPrivate.cmake.in
Joerg Bornemann 7782f2ad14 CMake: Don't enforce find_package(Qt6FooPrivate) for Qt 6.9
Requiring users to do find_package(Qt6FooPrivate) to use private modules
turned out to be a too invasive change for Qt 6.9. We turn off this
behavior and restrict it to the dev branch.

[ChangeLog][CMake] The requirement to do find_package(Qt6FooPrivate) in
user projects was postponed to a later Qt version.

Task-number: QTBUG-87776
Change-Id: Ifbf676288587ae5fabe100bf3bd93b220ddbc5ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-01-27 18:33:03 +01:00

65 lines
3.1 KiB
CMake

# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
@PACKAGE_INIT@
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
include(CMakeFindDependencyMacro)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Dependencies.cmake")
_qt_internal_suggest_dependency_debugging(@target_private@
__qt_@target_private@_pkg ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE)
endif()
# If *ConfigDependencies.cmake exists, the variable value will be defined there.
# Don't override it in that case.
if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND")
set("@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND" TRUE)
endif()
if(NOT DEFINED QT_REPO_MODULE_VERSION
AND NOT QT_NO_PRIVATE_MODULE_WARNING
AND NOT __qt_private_module_@target_private@_warning_shown)
message(WARNING
"This project is using headers of the @target_private@ module and will therefore be tied "
"to this specific Qt module build version. "
"Running this project against other versions of the Qt modules may crash at any arbitrary "
"point. This is not a bug, but a result of using Qt internals. You have been warned! "
"\nYou can disable this warning by setting QT_NO_PRIVATE_MODULE_WARNING to ON."
)
set(__qt_private_module_@target_private@_warning_shown TRUE)
endif()
if(NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@AdditionalTargetInfo.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@ExtraProperties.cmake"
OPTIONAL)
endif()
if(TARGET @QT_CMAKE_EXPORT_NAMESPACE@::@target_private@)
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
if(CMAKE_VERSION VERSION_LESS 3.18 OR QT_USE_OLD_VERSION_LESS_TARGETS)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessTargets.cmake")
else()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@VersionlessAliasTargets.cmake")
endif()
endif()
else()
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_FOUND FALSE)
if(NOT DEFINED @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE)
set(@INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Target \"@QT_CMAKE_EXPORT_NAMESPACE@::@target_private@\" was not found.")
if(QT_NO_CREATE_TARGETS)
string(APPEND @INSTALL_CMAKE_NAMESPACE@@target_private@_NOT_FOUND_MESSAGE
"Possibly due to QT_NO_CREATE_TARGETS being set to TRUE and thus "
"${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target_private@Targets.cmake was not "
"included to define the target.")
endif()
endif()
endif()