Use position-independent code on Android even when linking statically

This commit is contained in:
Bruno Van de Velde 2023-11-15 14:44:29 +01:00 committed by Chris Thrasher
parent f582f05365
commit fcf9f78a81

View File

@ -212,6 +212,12 @@ macro(sfml_add_library module)
sfml_set_common_ios_properties(${target}) sfml_set_common_ios_properties(${target})
endif() endif()
if(SFML_OS_ANDROID)
# Always use position-independent code on Android, even when linking statically.
# This is needed because all c++ code is placed in a shared library on Android.
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
# add the install rule # add the install rule
install(TARGETS ${target} EXPORT SFMLConfigExport install(TARGETS ${target} EXPORT SFMLConfigExport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT bin RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT bin