If a private module package is pulled in by another Qt module we showed the private module warning message. The user couldn't act on the warning other than disabling it completely. This doesn't seem useful. Now, we only show the warning if the user explicitly does find_package(Qt6FooPrivate). There's the situation where a private module is pulled in as dependency and later pulled in by the user. For example, in a static Linux build find_package(Qt6 REQUIRED COMPONENTS Gui CorePrivate) will pull in CorePrivate as transitive dependency of Gui's plugins. To still see a warning for CorePrivate in this case we need to trigger the warning in Qt6Config.cmake when handling the COMPONENTS. To achieve that, the warning code has been moved to a function which is called in Qt6Config.cmake and Qt6FooPrivateConfig.cmake Task-number: QTBUG-87776 Change-Id: Ie9cc2d287d1fcb94db77045165f703cebcb6983d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
56 lines
2.5 KiB
CMake
56 lines
2.5 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 __qt_@target@_always_load_private_module)
|
|
_qt_internal_show_private_module_warning(@target_private@)
|
|
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()
|