qtbase/cmake/QtPluginConfig.cmake.in
Alexandru Croitor 4a0d8b2bf8 CMake: Fix linking of qtsvg static plugins in standalone tests build
Our QtPluginConfig.cmake.in files have code to skip loading plugins
unless the repo is found in the QT_REPO_DEPENDENCIES variable
or when building standalone parts.

The problem is that QT_INTERNAL_BUILD_STANDALONE_PARTS is only
assigned a value after all the find_package calls have executed,
which is too late for the qtsvg standalone tests, because the svg icon
config file would already be loaded and skipped.

This code path checked for QT_BUILD_STANDALONE_TESTS, before the
introduction of the QT_INTERNAL_BUILD_STANDALONE_PARTS variable.

QT_BUILD_STANDALONE_TESTS is set by the qt-internal-configure-tests
script, so it is always available.

Restore the previous check for QT_BUILD_STANDALONE_TESTS, while
keeping the new variable as well.

This fixes the tst_qicon_svg test to pass in a static standalone tests
build.

Amends 62905163bf887c2c2c9ba7edcd64c96d237a6e95
Restores behavior of be1ee03a0fafa28efa0c0e45f21f9dc684625957

Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: I19f620a39fe530bf7f96498cfad1c90621983eb6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit c0e07cc3e2817d158d05e69e1254471ff6b074e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-10-21 14:04:07 +00:00

35 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()
@PACKAGE_INIT@
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
include(CMakeFindDependencyMacro)
get_filename_component(_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_import_prefix "${_import_prefix}" REALPATH)
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")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake")
endif()