From d47278fd09f73ddc34011ab980dafc23aa453e71 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Thu, 16 Sep 2021 18:13:25 +1000 Subject: [PATCH] Ensure _qt_is_android_executable is set for internal executables too The _qt_is_android_executable property is normally set by the _qt_internal_create_executable() command. But various other internal commands don't route through that and go through qt_internal_add_executable() instead. The former is used only by the public API, the latter only by the internal API. Refactor both so that the internal one calls the public one. This ensures all targets receive the same base settings, including the _qt_is_android_executable property. Fixes: QTBUG-96085 Pick-to: 6.2 Change-Id: I157356872c9d942d7be5f1abbbcbac97961b1f40 Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor --- cmake/QtExecutableHelpers.cmake | 15 ++------------- src/corelib/Qt6CoreMacros.cmake | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index 5e1f1ca28f0..b5fb18de4b2 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -19,13 +19,11 @@ function(qt_internal_add_executable name) set(arg_INSTALL_DIRECTORY "${INSTALL_BINDIR}") endif() + # TODO: EXE_FLAGS doesn't seem to be used anywhere, we can probably remove it + _qt_internal_create_executable(${name} ${arg_EXE_FLAGS}) if (ANDROID) - add_library("${name}" MODULE) - qt_android_apply_arch_suffix("${name}") qt_android_generate_deployment_settings("${name}") qt_android_add_apk_target("${name}") - else() - add_executable("${name}" ${arg_EXE_FLAGS}) endif() if(arg_QT_APP AND QT_FEATURE_debug_and_release AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.19.0") @@ -74,15 +72,6 @@ function(qt_internal_add_executable name) endif() qt_set_common_target_properties(${name}) - _qt_internal_set_up_static_runtime_library(${name}) - if(ANDROID) - # On our qmake builds we don't compile the executables with - # visibility=hidden. Not having this flag set will cause the - # executable to have main() hidden and can then no longer be loaded - # through dlopen() - set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default) - set_property(TARGET ${name} PROPERTY CXX_VISIBILITY_PRESET default) - endif() qt_autogen_tools_initial_setup(${name}) qt_skip_warnings_are_errors_when_repo_unclean("${name}") diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index 699d277f2ca..6e8825e44af 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -492,6 +492,7 @@ function(qt6_add_executable target) cmake_parse_arguments(PARSE_ARGV 1 arg "MANUAL_FINALIZATION" "" "") _qt_internal_create_executable("${target}" ${arg_UNPARSED_ARGUMENTS}) + target_link_libraries("${target}" PRIVATE Qt6::Core) if(arg_MANUAL_FINALIZATION) # Caller says they will call qt6_finalize_target() themselves later @@ -529,7 +530,6 @@ function(_qt_internal_create_executable target) add_executable("${target}" ${ARGN}) endif() - target_link_libraries("${target}" PRIVATE Qt6::Core) _qt_internal_set_up_static_runtime_library("${target}") endfunction()