425ff34aa1
In cmake, targets are used as an entity for modules. This causes a number of problems when we want to manipulate a module as a separate entity with properties associated with it. The _qt_internal_module_interface_name target property is introduced to represent the module entity. All modules write a name to this property, which will subsequently expand into the module name matched with the module name in qmake. The 'qt_internal_module_info' function is responsible for providing the correct values for the module properties used when working with a module target. Unlike qmake, for internal modules in cmake it is expected that the Private suffix will be specified explicitly. In case the user wants to have a different module name, an additional argument MODULE_INTERFACE_NAME of the qt_internal_add_module function is introduced. This also changes the way how target dependencies are collected and resolved. Since the 'Private' suffix no longer means an unique identifier of the module 'Private' part, we look for the both Private and non-Private package names when resolving dependencies. TODO: This change doesn't affect the existing internal modules, so to keep compatibility with the existing code the existing internal modules create 'Private' aliases. The code that provides backward compatibility must be removed once all internal modules will get the proper names. Taks-number: QTBUG-87775 Change-Id: Ib4f28341506fb2e73eee960a709e24c42bbcd5ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
63 lines
1.9 KiB
CMake
63 lines
1.9 KiB
CMake
set(@target@_FOUND FALSE)
|
|
|
|
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
|
|
set(_third_party_deps "@third_party_deps@")
|
|
|
|
foreach(_target_dep ${_third_party_deps})
|
|
list(GET _target_dep 0 pkg)
|
|
list(GET _target_dep 1 is_optional)
|
|
list(GET _target_dep 2 version)
|
|
list(GET _target_dep 3 components)
|
|
set(find_package_args "${pkg}")
|
|
if(version)
|
|
list(APPEND find_package_args "${version}")
|
|
endif()
|
|
if(components)
|
|
string(REPLACE " " ";" components "${components}")
|
|
list(APPEND find_package_args COMPONENTS ${components})
|
|
endif()
|
|
|
|
if(is_optional)
|
|
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
|
list(APPEND find_package_args QUIET)
|
|
endif()
|
|
find_package(${find_package_args})
|
|
else()
|
|
find_dependency(${find_package_args})
|
|
endif()
|
|
endforeach()
|
|
|
|
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()
|
|
|
|
# TODO: The dependencies lookup mechanism is common for Modules and Plugins.
|
|
# It should be moved to the common public helper file.
|
|
#
|
|
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
|
|
set(_target_deps "@target_deps@")
|
|
foreach(_target_dep ${_target_deps})
|
|
list(GET _target_dep 0 pkg)
|
|
list(GET _target_dep 1 version)
|
|
|
|
if (NOT ${pkg}_FOUND)
|
|
set(pkg_names ${pkg})
|
|
if(pkg MATCHES "(.*)Private$")
|
|
set(pkg_names "${CMAKE_MATCH_1};${pkg}")
|
|
endif()
|
|
find_dependency(${pkg} ${version}
|
|
NAMES
|
|
${pkg_names}
|
|
PATHS
|
|
@find_dependency_paths@
|
|
${_qt_additional_packages_prefix_path}
|
|
${_qt_additional_packages_prefix_path_env}
|
|
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
|
|
${__qt_use_no_default_path_for_qt_packages}
|
|
)
|
|
endif()
|
|
endforeach()
|
|
|
|
set(@target@_FOUND TRUE)
|