summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-09-20 11:20:46 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-20 13:10:58 +0000
commita72d2f7f3fb7576067dd2b88864a4231a5109aef (patch)
treedfaf5e202974a8426e8571f1885119aeed1e2ed0 /cmake
parent371e6abb963e12178f58f8356c51d3c82dcd2e60 (diff)
Fix main() not being visible on Android
A recent change refactored the call to qt_internal_add_executable(), but that had the unintended side-effect of changing the symbol visibility from public to hidden. That meant that main() became hidden, so while apps still built successfully, they could not be run. Restore the original symbol visibility to fix this regression. Amends d47278fd09f73ddc34011ab980dafc23aa453e71 Change-Id: I27d84ab2b0dd013d5c38dcfe55e88f307c4bc5dd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 46438c91f71249d89b17fd80ec0a00cd9166c63e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtExecutableHelpers.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake
index b6aec5b6a6..4320d7bd7c 100644
--- a/cmake/QtExecutableHelpers.cmake
+++ b/cmake/QtExecutableHelpers.cmake
@@ -71,6 +71,14 @@ function(qt_internal_add_executable name)
endif()
qt_set_common_target_properties(${name})
+ if(ANDROID)
+ # The above call to qt_set_common_target_properties() sets the symbol
+ # visibility to hidden, but for Android, we need main() to not be hidden
+ # because it has to be loadable at runtime using 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}")