Merge topic 'android-stl'

4dca078829 Android: Link c++abi and android_support when necessary
738caa4d48 Android: Add options to control exceptions/rtti

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5444
This commit is contained in:
Brad King
2020-11-05 12:55:39 +00:00
committed by Kitware Robot
4 changed files with 28 additions and 0 deletions
+2
View File
@@ -336,6 +336,7 @@ Variables that Control the Build
/variable/CMAKE_ANDROID_ARM_MODE
/variable/CMAKE_ANDROID_ARM_NEON
/variable/CMAKE_ANDROID_ASSETS_DIRECTORIES
/variable/CMAKE_ANDROID_EXCEPTIONS
/variable/CMAKE_ANDROID_GUI
/variable/CMAKE_ANDROID_JAR_DEPENDENCIES
/variable/CMAKE_ANDROID_JAR_DIRECTORIES
@@ -349,6 +350,7 @@ Variables that Control the Build
/variable/CMAKE_ANDROID_PROCESS_MAX
/variable/CMAKE_ANDROID_PROGUARD
/variable/CMAKE_ANDROID_PROGUARD_CONFIG_PATH
/variable/CMAKE_ANDROID_RTTI
/variable/CMAKE_ANDROID_SECURE_PROPS_PATH
/variable/CMAKE_ANDROID_SKIP_ANT_STEP
/variable/CMAKE_ANDROID_STANDALONE_TOOLCHAIN
@@ -0,0 +1,7 @@
CMAKE_ANDROID_EXCEPTIONS
------------------------
.. versionadded:: 3.20
When :ref:`Cross Compiling for Android with the NDK`, this variable may be set
to specify whether exceptions are enabled.
+7
View File
@@ -0,0 +1,7 @@
CMAKE_ANDROID_RTTI
------------------
.. versionadded:: 3.20
When :ref:`Cross Compiling for Android with the NDK`, this variable may be set
to specify whether RTTI is enabled.
+12
View File
@@ -53,6 +53,12 @@ if(CMAKE_ANDROID_STL_TYPE)
set(_ANDROID_STL_RTTI 0)
macro(__android_stl lang)
string(APPEND CMAKE_${lang}_FLAGS_INIT " -stdlib=libstdc++")
if(_ANDROID_STL_EXCEPTIONS OR _ANDROID_STL_RTTI)
string(APPEND CMAKE_${lang}_STANDARD_LIBRARIES " -lc++abi")
if(CMAKE_SYSTEM_VERSION LESS 21)
list(APPEND CMAKE_${lang}_STANDARD_LIBRARIES "-landroid_support")
endif()
endif()
endmacro()
elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "c++_static")
set(_ANDROID_STL_EXCEPTIONS 1)
@@ -81,6 +87,12 @@ if(CMAKE_ANDROID_STL_TYPE)
"Android: STL '${CMAKE_ANDROID_STL_TYPE}' not supported by this NDK."
)
endif()
if(DEFINED CMAKE_ANDROID_RTTI)
set(_ANDROID_STL_RTTI ${CMAKE_ANDROID_RTTI})
endif()
if(DEFINED CMAKE_ANDROID_EXCEPTIONS)
set(_ANDROID_STL_EXCEPTIONS ${CMAKE_ANDROID_EXCEPTIONS})
endif()
elseif(CMAKE_ANDROID_NDK)
macro(__android_stl_inc lang dir req)