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
Change-Id: I157356872c9d942d7be5f1abbbcbac97961b1f40
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d47278fd09f73ddc34011ab980dafc23aa453e71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Craig Scott 2021-09-16 18:13:25 +10:00 committed by Qt Cherry-pick Bot
parent 236675f7c0
commit 96b4bbf2cf
2 changed files with 3 additions and 14 deletions

View File

@ -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}")

View File

@ -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()