The plugin lookup mechanism doesn't handle the situation, when the plugin is available but it's private dependency(static plugin case) is missing. In this case we currently silently bypass the dependency lookup and create targets. So users see the confusing message about missing linked target, like: Qt6QSQLiteDriverPluginTargets.cmake:61 (set_target_properties): The link interface of target "Qt6::QSQLiteDriverPlugin" contains: SQLite::SQLite3 but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. This indeed should be handled properly and we should omit creating targets especially if users don't really use the plugin directly. Also if dependencies are not satisfied it looks logically to set the <plugin>_FOUND to false as this will be yet another indicator for user that the plugin is not found. Task-number: QTBUG-132244 Pick-to: 6.8 6.9 6.5 Change-Id: I8685163df0dee3a728c724901f69780569ffcad5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
38 lines
1.2 KiB
CMake
38 lines
1.2 KiB
CMake
# Copyright (C) 2024 The Qt Company Ltd.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
include_guard(DIRECTORY)
|
|
|
|
if(DEFINED QT_REPO_DEPENDENCIES
|
|
AND NOT QT_INTERNAL_BUILD_STANDALONE_PARTS
|
|
AND NOT QT_BUILD_STANDALONE_TESTS)
|
|
# We're building a Qt repository.
|
|
# Skip this plugin if it has not been provided by one of this repo's dependencies.
|
|
string(TOLOWER "@PROJECT_NAME@" lower_case_project_name)
|
|
if(NOT lower_case_project_name IN_LIST QT_REPO_DEPENDENCIES)
|
|
return()
|
|
endif()
|
|
endif()
|
|
|
|
@skip_internal_test_plugin@
|
|
|
|
@PACKAGE_INIT@
|
|
|
|
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
|
|
|
|
include(CMakeFindDependencyMacro)
|
|
|
|
if (NOT QT_NO_CREATE_TARGETS)
|
|
# Find required dependencies, if any.
|
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
|
|
else()
|
|
set(@target@_FOUND TRUE)
|
|
endif()
|
|
|
|
if(@target@_FOUND)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
|
|
endif()
|
|
endif()
|