Replace qt_record_extra_qt_package_dependency with qt_register_target_dependencies
qt_register_target_dependencies does the same thing as qt_record_extra_qt_package_dependency but in more convenient way. Update the qt_register_target_dependencies signature and adjust naming, it now accepts PUBLIC and PRIVATE multi-value arguments and called qt_internal_register_target_dependencies. Use it and deprecate qt_record_extra_qt_package_dependency. Pick-to: 6.8 6.5 Change-Id: I0594cf699ec1e3af7210dd7450fa3f81c1f565ae Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8272b747d3b91e15fda2b76326221a26fb2245d2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b51ee7068c
commit
9521b51eef
@ -387,6 +387,8 @@ endfunction()
|
|||||||
# dep_target_name = EntryPointPrivate
|
# dep_target_name = EntryPointPrivate
|
||||||
# This is just a convenience function that deals with Qt targets and their associated packages
|
# This is just a convenience function that deals with Qt targets and their associated packages
|
||||||
# instead of raw package names.
|
# instead of raw package names.
|
||||||
|
#
|
||||||
|
# Deprecated since 6.9.
|
||||||
function(qt_record_extra_qt_package_dependency main_target_name dep_target_name
|
function(qt_record_extra_qt_package_dependency main_target_name dep_target_name
|
||||||
dep_package_version)
|
dep_package_version)
|
||||||
# EntryPointPrivate -> Qt6EntryPointPrivate.
|
# EntryPointPrivate -> Qt6EntryPointPrivate.
|
||||||
@ -571,17 +573,26 @@ function(qt_internal_get_package_name_of_target target package_name_out_var)
|
|||||||
set(${package_name_out_var} "${package_name}" PARENT_SCOPE)
|
set(${package_name_out_var} "${package_name}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# This function stores the list of Qt targets a library depend on,
|
# This function collects the list of Qt targets a library depend on,
|
||||||
# along with their version info, for usage in ${target}Depends.cmake file
|
# along with their version info, for usage in ${target}Dependencies.cmake file
|
||||||
function(qt_register_target_dependencies target public_libs private_libs)
|
# Multi-value Arguments:
|
||||||
|
# PUBLIC
|
||||||
|
# public dependencies
|
||||||
|
# PRIVATE
|
||||||
|
# private dependencies
|
||||||
|
function(qt_internal_register_target_dependencies target)
|
||||||
|
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "PUBLIC;PRIVATE")
|
||||||
get_target_property(target_deps "${target}" _qt_target_deps)
|
get_target_property(target_deps "${target}" _qt_target_deps)
|
||||||
if(NOT target_deps)
|
if(NOT target_deps)
|
||||||
set(target_deps "")
|
set(target_deps "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_target_property(target_type ${target} TYPE)
|
set(lib_list "")
|
||||||
set(lib_list ${public_libs})
|
if(arg_PUBLIC)
|
||||||
|
set(lib_list "${arg_PUBLIC}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_target_property(target_type ${target} TYPE)
|
||||||
set(target_is_shared FALSE)
|
set(target_is_shared FALSE)
|
||||||
set(target_is_static FALSE)
|
set(target_is_static FALSE)
|
||||||
if(target_type STREQUAL "SHARED_LIBRARY")
|
if(target_type STREQUAL "SHARED_LIBRARY")
|
||||||
@ -595,8 +606,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
|
|||||||
#
|
#
|
||||||
# Private static library dependencies will become $<LINK_ONLY:> dependencies in
|
# Private static library dependencies will become $<LINK_ONLY:> dependencies in
|
||||||
# INTERFACE_LINK_LIBRARIES.
|
# INTERFACE_LINK_LIBRARIES.
|
||||||
if(target_is_static)
|
if(target_is_static AND arg_PRIVATE)
|
||||||
list(APPEND lib_list ${private_libs})
|
list(APPEND lib_list ${arg_PRIVATE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(lib IN LISTS lib_list)
|
foreach(lib IN LISTS lib_list)
|
||||||
@ -622,8 +633,8 @@ function(qt_register_target_dependencies target public_libs private_libs)
|
|||||||
# See QTBUG-86533 for some details.
|
# See QTBUG-86533 for some details.
|
||||||
# We filter out static libraries and common platform targets, but include both SHARED and
|
# We filter out static libraries and common platform targets, but include both SHARED and
|
||||||
# INTERFACE libraries. INTERFACE libraries in most cases will be FooPrivate libraries.
|
# INTERFACE libraries. INTERFACE libraries in most cases will be FooPrivate libraries.
|
||||||
if(target_is_shared AND private_libs)
|
if(target_is_shared AND arg_PRIVATE)
|
||||||
foreach(lib IN LISTS private_libs)
|
foreach(lib IN LISTS arg_PRIVATE)
|
||||||
set(lib_namespaced "${lib}")
|
set(lib_namespaced "${lib}")
|
||||||
if("${lib}" MATCHES "^Qt::(.*)")
|
if("${lib}" MATCHES "^Qt::(.*)")
|
||||||
set(lib "${CMAKE_MATCH_1}")
|
set(lib "${CMAKE_MATCH_1}")
|
||||||
|
@ -342,7 +342,7 @@ function(qt_internal_add_module target)
|
|||||||
EXPORT_PROPERTIES "${export_properties}")
|
EXPORT_PROPERTIES "${export_properties}")
|
||||||
|
|
||||||
# Let find_package(Qt6FooPrivate) also find_package(Qt6Foo).
|
# Let find_package(Qt6FooPrivate) also find_package(Qt6Foo).
|
||||||
qt_register_target_dependencies("${target_private}" "Qt::${target}" "")
|
qt_internal_register_target_dependencies("${target_private}" PUBLIC "Qt::${target}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# FIXME: This workaround is needed because the deployment logic
|
# FIXME: This workaround is needed because the deployment logic
|
||||||
|
@ -337,7 +337,15 @@ function(qt_internal_add_plugin target)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}")
|
set(qt_register_target_dependencies_args "")
|
||||||
|
if(arg_PUBLIC_LIBRARIES)
|
||||||
|
list(APPEND qt_register_target_dependencies_args PUBLIC ${arg_PUBLIC_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
if(qt_libs_private)
|
||||||
|
list(APPEND qt_register_target_dependencies_args PRIVATE ${qt_libs_private})
|
||||||
|
endif()
|
||||||
|
qt_internal_register_target_dependencies("${target}"
|
||||||
|
${qt_register_target_dependencies_args})
|
||||||
|
|
||||||
if(target_type STREQUAL STATIC_LIBRARY)
|
if(target_type STREQUAL STATIC_LIBRARY)
|
||||||
if(qt_module_target)
|
if(qt_module_target)
|
||||||
|
@ -167,8 +167,11 @@ function(qt_internal_create_module_depends_file target)
|
|||||||
set(qt_module_dependencies "")
|
set(qt_module_dependencies "")
|
||||||
|
|
||||||
if(NOT is_interface_lib)
|
if(NOT is_interface_lib)
|
||||||
|
# TODO: deprecated code path. QT_EXTRA_PACKAGE_DEPENDENCIES shouldn't be used for the Qt
|
||||||
|
# packages.
|
||||||
get_target_property(extra_depends "${target}" QT_EXTRA_PACKAGE_DEPENDENCIES)
|
get_target_property(extra_depends "${target}" QT_EXTRA_PACKAGE_DEPENDENCIES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT extra_depends MATCHES "-NOTFOUND$")
|
if(NOT extra_depends MATCHES "-NOTFOUND$")
|
||||||
list(APPEND target_deps "${extra_depends}")
|
list(APPEND target_deps "${extra_depends}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -266,10 +266,18 @@ function(qt_internal_extend_target target)
|
|||||||
"Ensure the target exists or remove the option.")
|
"Ensure the target exists or remove the option.")
|
||||||
message(AUTHOR_WARNING "${warning_message}")
|
message(AUTHOR_WARNING "${warning_message}")
|
||||||
endif()
|
endif()
|
||||||
qt_register_target_dependencies("${target}"
|
|
||||||
"${arg_PUBLIC_LIBRARIES};${arg_PRIVATE_MODULE_INTERFACE}"
|
|
||||||
"${qt_libs_private};${arg_LIBRARIES}")
|
|
||||||
|
|
||||||
|
set(qt_register_target_dependencies_args "")
|
||||||
|
if(arg_PUBLIC_LIBRARIES OR arg_PRIVATE_MODULE_INTERFACE)
|
||||||
|
list(APPEND qt_register_target_dependencies_args
|
||||||
|
PUBLIC ${arg_PUBLIC_LIBRARIES} ${arg_PRIVATE_MODULE_INTERFACE})
|
||||||
|
endif()
|
||||||
|
if(qt_libs_private OR arg_LIBRARIES)
|
||||||
|
list(APPEND qt_register_target_dependencies_args
|
||||||
|
PRIVATE ${qt_libs_private} ${arg_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
qt_internal_register_target_dependencies("${target}"
|
||||||
|
${qt_register_target_dependencies_args})
|
||||||
|
|
||||||
qt_autogen_tools(${target}
|
qt_autogen_tools(${target}
|
||||||
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
|
ENABLE_AUTOGEN_TOOLS ${arg_ENABLE_AUTOGEN_TOOLS}
|
||||||
|
@ -1459,8 +1459,8 @@ qt_internal_apply_gc_binaries_conditional(Core PUBLIC)
|
|||||||
if(WIN32 OR UIKIT)
|
if(WIN32 OR UIKIT)
|
||||||
# find_package(Qt6Core) should call find_package(Qt6EntryPointPrivate) so that we can
|
# find_package(Qt6Core) should call find_package(Qt6EntryPointPrivate) so that we can
|
||||||
# link against EntryPointPrivate. Normally this is handled automatically for deps, but
|
# link against EntryPointPrivate. Normally this is handled automatically for deps, but
|
||||||
# for some reason it doesn't work for the EntryPointPrivate, so we need to add it manually.
|
# it doesn't work for EntryPointPrivate since its linker line contains the generator expression.
|
||||||
qt_record_extra_qt_package_dependency(Core EntryPointPrivate "${PROJECT_VERSION}")
|
qt_internal_register_target_dependencies(Core PUBLIC Qt6::EntryPointPrivate)
|
||||||
|
|
||||||
set(entrypoint_conditions "$<NOT:$<BOOL:$<TARGET_PROPERTY:qt_no_entrypoint>>>")
|
set(entrypoint_conditions "$<NOT:$<BOOL:$<TARGET_PROPERTY:qt_no_entrypoint>>>")
|
||||||
list(APPEND entrypoint_conditions "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>")
|
list(APPEND entrypoint_conditions "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user