19e789bace
This proposal collects all the resource objects to the qt-specific
property of the static libraries. This is done to avoid littering
of other static libraries and put resource object files to the
source part of the linker line when linking the end-point
executable.
The way we link object resource libraries is changed back to the
target_link_libraries approach as we may omit using finalizers
with linkers other than ld. Users may enforce finalizers by calling
the qt6_enable_resource_objects_finalizer_mode function if need.
Refactor tests related to the static resources.
Amends ddaa7150d8
Task-number: QTBUG-93002
Change-Id: I74135e291cd82fb54d1b284b4b4a1e002b1fef98
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
107 lines
4.8 KiB
CMake
107 lines
4.8 KiB
CMake
@PACKAGE_INIT@
|
|
|
|
cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_version@)
|
|
|
|
get_filename_component(_qt_cmake_dir "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
|
set(_qt_@PROJECT_VERSION_MAJOR@_config_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
|
|
|
|
if (NOT QT_NO_CREATE_TARGETS)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Targets.cmake")
|
|
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@VersionlessTargets.cmake")
|
|
endif()
|
|
else()
|
|
# For examples using `find_package(...)` inside their CMakeLists.txt files:
|
|
# Make CMake's AUTOGEN detect this Qt version properly
|
|
set_directory_properties(PROPERTIES
|
|
QT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
|
QT_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
|
QT_VERSION_PATCH @PROJECT_VERSION_PATCH@)
|
|
endif()
|
|
|
|
if(NOT "${QT_HOST_PATH}" STREQUAL "")
|
|
find_package(Qt@PROJECT_VERSION_MAJOR@HostInfo
|
|
CONFIG
|
|
REQUIRED
|
|
PATHS "${QT_HOST_PATH}"
|
|
"${QT_HOST_PATH_CMAKE_DIR}"
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
NO_DEFAULT_PATH)
|
|
endif()
|
|
|
|
# if (NOT @INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS)
|
|
# set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "The Qt package requires at least one component")
|
|
# set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
|
# return()
|
|
# endif()
|
|
|
|
get_filename_component(_qt_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
get_filename_component(_qt_import_prefix "${_qt_import_prefix}" REALPATH)
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}")
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/extra-cmake-modules/find-modules")
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/3rdparty/kwin")
|
|
|
|
if(APPLE AND (NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
|
|
# Add module directory to pick up custom Info.plist template for macOS
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/macos")
|
|
elseif(APPLE AND CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
|
# Add module directory to pick up custom Info.plist template for iOS
|
|
list(APPEND CMAKE_MODULE_PATH "${_qt_import_prefix}/ios")
|
|
endif()
|
|
|
|
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING "Additional directories where find(Qt6 ...) components are searched")
|
|
file(TO_CMAKE_PATH "${QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path)
|
|
file(TO_CMAKE_PATH "$ENV{QT_ADDITIONAL_PACKAGES_PREFIX_PATH}" _qt_additional_packages_prefix_path_env)
|
|
|
|
# Public helpers available to all Qt packages.
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtFeature.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFinalizerHelpers.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicPluginHelpers.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTargetHelpers.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWalkLibsHelpers.cmake")
|
|
|
|
# Find required dependencies, if any.
|
|
include(CMakeFindDependencyMacro)
|
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
|
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@Dependencies.cmake")
|
|
if(NOT @INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND)
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
|
|
message(FATAL_ERROR "Failed to find Qt Platform dependency: "
|
|
"${@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE}")
|
|
endif()
|
|
endif()
|
|
|
|
set(__qt_use_no_default_path_for_qt_packages "NO_DEFAULT_PATH")
|
|
if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
|
|
set(__qt_use_no_default_path_for_qt_packages "")
|
|
endif()
|
|
|
|
foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
|
|
find_package(@INSTALL_CMAKE_NAMESPACE@${module}
|
|
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
|
|
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_REQUIRED}
|
|
PATHS
|
|
${_qt_cmake_dir}
|
|
${_qt_additional_packages_prefix_path}
|
|
${_qt_additional_packages_prefix_path_env}
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
)
|
|
if (NOT @INSTALL_CMAKE_NAMESPACE@${module}_FOUND)
|
|
string(CONFIGURE ${_qt5_module_location_template} _expected_module_location @ONLY)
|
|
|
|
if (@INSTALL_CMAKE_NAMESPACE@_FIND_REQUIRED_${module})
|
|
set(_Qt_NOTFOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"\n")
|
|
elseif(NOT @INSTALL_CMAKE_NAMESPACE@_FIND_QUIETLY)
|
|
message(WARNING "Failed to find Qt component \"${module}\" config file at \"${_expected_module_location}\"")
|
|
endif()
|
|
|
|
unset(_expected_module_location)
|
|
endif()
|
|
endforeach()
|
|
|
|
if (_Qt_NOTFOUND_MESSAGE)
|
|
set(@INSTALL_CMAKE_NAMESPACE@_NOT_FOUND_MESSAGE "${_Qt_NOTFOUND_MESSAGE}")
|
|
set(@INSTALL_CMAKE_NAMESPACE@_FOUND False)
|
|
endif()
|