Clean up application module visibility on Android

Disable ELF visibility using CMake properties on the shared object
that's supposed to contain main().

Change-Id: I9cdbb2a76ad66cf2742280ddfea47908eaff2370
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-06-26 16:19:13 +02:00
parent 872293ad58
commit d9da52d561

View File

@ -392,6 +392,12 @@ endif()
function(add_qt_gui_executable target)
if(ANDROID)
add_library("${target}" MODULE ${ARGN})
# On our qmake builds we do 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 "${target}" PROPERTY C_VISIBILITY_PRESET default)
set_property(TARGET "${target}" PROPERTY CXX_VISIBILITY_PRESET default)
else()
add_executable("${target}" WIN32 MACOSX_BUNDLE ${ARGN})
endif()
@ -399,11 +405,6 @@ function(add_qt_gui_executable target)
if(ANDROID)
qt_android_generate_deployment_settings("${target}")
# On our qmake builds we do 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()
target_compile_options(${target} PRIVATE -fvisibility=default)
endif()
endfunction()