c6a5cdcee6
Add an abstraction over Qt::WinMain (aka qtmain.lib) and iOS's runtime linker entry point (_qt_main_wrapper). The Core target will now link against the Startup target on all platforms, instead of just WinMain on Windows. The creation and linkage interface definition of the Startup target is done at find_package(Qt6Core) time via the private call of _qt_internal_setup_startup_target(). This will add automatic linkage of WinMain to executables marked with the WIN32_EXECUTABLE property on Windows. As well as the addition of the '-Wl,-e,_qt_main_wrapper' linker flag when linking iOS executables. Qt users can opt out of this behavior by either setting the QT_NO_LINK_QTMAIN property or variable. This is in line with Qt 5 behavior. Task-number: QTBUG-87060 Change-Id: I7d5e9f1be0e402cf8e67e6f55bfd285f9e6b04f4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
17 lines
672 B
CMake
17 lines
672 B
CMake
# Set up some internal requirements for the Startup target.
|
|
#
|
|
# The creation of the Startup target and its linkage setup happens in 2 places:
|
|
# - in src/corelib/CMakeLists.txt when building qtbase.
|
|
# - at find_package(Qt6Core) time.
|
|
#
|
|
# See _qt_internal_setup_startup_target() in Qt6CoreMacros.cmake for the implementation of that.
|
|
function(qt_internal_setup_startup_target)
|
|
set(dependent_target "Core")
|
|
|
|
# On windows, find_package(Qt6Core) should call find_package(Qt6WinMain) so that Startup can
|
|
# link against WinMain.
|
|
if(WIN32)
|
|
qt_record_extra_qt_package_dependency("${dependent_target}" WinMain "${PROJECT_VERSION}")
|
|
endif()
|
|
endfunction()
|