Adjust the EntryPoint target name according to the internal module naming policy
Pick-to: 6.2 Task-number: QTBUG-87775 Change-Id: I1d6097c950f97e102c44e2952edc98caa4deb6c6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
01d30e2d53
commit
02855ff6e0
@ -209,14 +209,14 @@ endfunction()
|
||||
|
||||
# This function records a dependency between ${main_target_name} and ${dep_target_name}
|
||||
# at the CMake package level.
|
||||
# E.g. Qt6CoreConfig.cmake needs to find_package(Qt6EntryPoint).
|
||||
# E.g. Qt6CoreConfig.cmake needs to find_package(Qt6EntryPointPrivate).
|
||||
# main_target_name = Core
|
||||
# dep_target_name = EntryPoint
|
||||
# dep_target_name = EntryPointPrivate
|
||||
# This is just a convenience function that deals with Qt targets and their associated packages
|
||||
# instead of raw package names.
|
||||
function(qt_record_extra_qt_package_dependency main_target_name dep_target_name
|
||||
dep_package_version)
|
||||
# EntryPoint -> Qt6EntryPoint.
|
||||
# EntryPointPrivate -> Qt6EntryPointPrivate.
|
||||
qt_internal_qtfy_target(qtfied_target_name "${dep_target_name}")
|
||||
qt_record_extra_package_dependency("${main_target_name}"
|
||||
"${qtfied_target_name_versioned}" "${dep_package_version}")
|
||||
|
@ -83,12 +83,13 @@ function(__qt_internal_walk_libs
|
||||
endif()
|
||||
list(APPEND collected ${target})
|
||||
|
||||
if(target STREQUAL "${QT_CMAKE_EXPORT_NAMESPACE}::EntryPoint")
|
||||
# We can't (and don't need to) process EntryPoint because it brings in $<TARGET_PROPERTY:prop>
|
||||
# genexes which get replaced with $<TARGET_PROPERTY:EntryPoint,prop> genexes in the code below
|
||||
# and that causes 'INTERFACE_LIBRARY targets may only have whitelisted properties.' errors
|
||||
# with CMake versions equal to or lower than 3.18. These errors are super unintuitive to
|
||||
# debug because there's no mention that it's happening during a file(GENERATE) call.
|
||||
if(target STREQUAL "${QT_CMAKE_EXPORT_NAMESPACE}::EntryPointPrivate")
|
||||
# We can't (and don't need to) process EntryPointPrivate because it brings in
|
||||
# $<TARGET_PROPERTY:prop> genexes which get replaced with
|
||||
# $<TARGET_PROPERTY:EntryPointPrivate,prop> genexes in the code below and that causes
|
||||
# 'INTERFACE_LIBRARY targets may only have whitelisted properties.' errors with CMake
|
||||
# versions equal to or lower than 3.18. These errors are super unintuitive to debug
|
||||
# because there's no mention that it's happening during a file(GENERATE) call.
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
@ -1335,10 +1335,10 @@ qt_internal_apply_gc_binaries_conditional(Core PUBLIC)
|
||||
# Add entry-point on platforms that need it. A project can opt-out of using the
|
||||
# entrypoint by setting the qt_no_entrypoint property to TRUE on a target.
|
||||
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
# find_package(Qt6Core) should call find_package(Qt6EntryPoint) so that we can
|
||||
# link against EntryPoint. Normally this is handled automatically for deps, but
|
||||
# for some reason it doesn't work for the EntryPoint, so we need to add it manually.
|
||||
qt_record_extra_qt_package_dependency(Core EntryPoint "${PROJECT_VERSION}")
|
||||
# find_package(Qt6Core) should call find_package(Qt6EntryPointPrivate) so that we can
|
||||
# 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.
|
||||
qt_record_extra_qt_package_dependency(Core EntryPointPrivate "${PROJECT_VERSION}")
|
||||
|
||||
set(entrypoint_conditions "$<NOT:$<BOOL:$<TARGET_PROPERTY:qt_no_entrypoint>>>")
|
||||
list(APPEND entrypoint_conditions "$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>")
|
||||
@ -1350,7 +1350,9 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
list(JOIN entrypoint_conditions "," entrypoint_conditions)
|
||||
set(entrypoint_conditions "$<AND:${entrypoint_conditions}>")
|
||||
|
||||
target_link_libraries(Core INTERFACE "$<${entrypoint_conditions}:${QT_CMAKE_EXPORT_NAMESPACE}::EntryPoint>")
|
||||
target_link_libraries(Core INTERFACE
|
||||
"$<${entrypoint_conditions}:${QT_CMAKE_EXPORT_NAMESPACE}::EntryPointPrivate>"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Record darwin minimum deployment target.
|
||||
|
@ -4,14 +4,14 @@ if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# The EntryPoint package consists of two targets: one for CMake consumption,
|
||||
# The EntryPointPrivate package consists of two targets: one for CMake consumption,
|
||||
# and one internal that produces the static library. Together these form the
|
||||
# entrypoint module in qmake terms. This split allows us to inject library
|
||||
# dependencies that need to go _before_ the static library, to work around
|
||||
# CMake's lack of whole archive.
|
||||
|
||||
# ---- The header-only target produces the actual module ----
|
||||
qt_internal_add_module(EntryPoint
|
||||
qt_internal_add_module(EntryPointPrivate
|
||||
HEADER_MODULE
|
||||
INTERNAL_MODULE
|
||||
NO_SYNC_QT
|
||||
@ -20,9 +20,9 @@ qt_internal_add_module(EntryPoint
|
||||
NO_ADDITIONAL_TARGET_INFO
|
||||
)
|
||||
|
||||
set(export_targets EntryPoint)
|
||||
set(export_targets EntryPointPrivate)
|
||||
# We don't need any include paths or default module defines
|
||||
set_target_properties(EntryPoint PROPERTIES
|
||||
set_target_properties(EntryPointPrivate PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ""
|
||||
INTERFACE_COMPILE_DEFINITIONS ""
|
||||
)
|
||||
@ -70,28 +70,34 @@ if(WIN32)
|
||||
# The mingw32 library needs to come before the entry-point library in the
|
||||
# linker line, so that the static linker will pick up the WinMain symbol
|
||||
# from the entry-point library.
|
||||
target_link_libraries(EntryPoint INTERFACE mingw32)
|
||||
set_property(TARGET EntryPoint APPEND PROPERTY INTERFACE_QT_MODULE_LDFLAGS "-lmingw32")
|
||||
target_link_libraries(EntryPointPrivate INTERFACE mingw32)
|
||||
set_property(TARGET EntryPointPrivate
|
||||
APPEND PROPERTY INTERFACE_QT_MODULE_LDFLAGS "-lmingw32"
|
||||
)
|
||||
|
||||
target_compile_definitions(EntryPoint INTERFACE QT_NEEDS_QMAIN)
|
||||
target_compile_definitions(EntryPointPrivate INTERFACE QT_NEEDS_QMAIN)
|
||||
qt_internal_extend_target(EntryPointImplementation DEFINES QT_NEEDS_QMAIN)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set_target_properties(EntryPoint PROPERTIES INTERFACE_LINK_OPTIONS "-Wl,-e,_qt_main_wrapper")
|
||||
set_property(TARGET EntryPoint APPEND PROPERTY INTERFACE_QT_MODULE_LDFLAGS "-Wl,-e,_qt_main_wrapper")
|
||||
set_target_properties(EntryPointPrivate PROPERTIES
|
||||
INTERFACE_LINK_OPTIONS "-Wl,-e,_qt_main_wrapper"
|
||||
)
|
||||
set_property(TARGET EntryPointPrivate
|
||||
APPEND PROPERTY INTERFACE_QT_MODULE_LDFLAGS "-Wl,-e,_qt_main_wrapper"
|
||||
)
|
||||
endif()
|
||||
|
||||
# ---- Finally, make sure the static library can be consumed by clients -----
|
||||
|
||||
if(using_entrypoint_library)
|
||||
target_link_libraries(EntryPoint INTERFACE Qt6::EntryPointImplementation)
|
||||
target_link_libraries(EntryPointPrivate INTERFACE Qt6::EntryPointImplementation)
|
||||
|
||||
qt_internal_get_target_property(entrypoint_implementation_ldflags
|
||||
EntryPointImplementation QT_MODULE_LDFLAGS)
|
||||
|
||||
set_target_properties(EntryPoint PROPERTIES
|
||||
set_target_properties(EntryPointPrivate PROPERTIES
|
||||
INTERFACE_QT_MODULE_PRI_EXTRA_CONTENT "
|
||||
QT.entrypoint_implementation.name = QtEntryPointImplementation
|
||||
QT.entrypoint_implementation.module = Qt6EntryPoint${QT_LIBINFIX}
|
||||
@ -102,12 +108,12 @@ QT.entrypoint_implementation.module_config = staticlib v2 internal_module
|
||||
INTERFACE_QT_MODULE_DEPENDS "entrypoint_implementation"
|
||||
)
|
||||
|
||||
set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointTargets")
|
||||
set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointPrivateTargets")
|
||||
qt_install(TARGETS EntryPointImplementation EXPORT ${export_name})
|
||||
qt_generate_prl_file(EntryPointImplementation "${INSTALL_LIBDIR}")
|
||||
endif()
|
||||
|
||||
set(export_name_prefix "${INSTALL_CMAKE_NAMESPACE}EntryPoint")
|
||||
set(export_name_prefix "${INSTALL_CMAKE_NAMESPACE}EntryPointPrivate")
|
||||
qt_path_join(config_install_dir ${QT_CONFIG_INSTALL_DIR} ${export_name_prefix})
|
||||
qt_internal_export_additional_targets_file(
|
||||
TARGETS ${export_targets}
|
||||
|
Loading…
x
Reference in New Issue
Block a user