Pass on Android toolchain flags for CXX runtime check.
@@ -203,11 +203,15 @@ function(test_cxx CXX_RUNTIME_NAME IS_STDLIB)
find_library(CXX_RUNTIME_LIB NAMES ${CXX_RUNTIME_NAME})
if (CXX_RUNTIME_LIB)
message(STATUS "Testing ${CXX_RUNTIME_LIB} as the C++ runtime library")
+ if (ANDROID)
+ # pass on Android toolchain flags
+ set(CXX_RUNTIME_FLAGS "-DANDROID_NDK=${ANDROID_NDK}" "-DANDROID_ABI=${ANDROID_ABI}" "-DANDROID_ARM_MODE=${ANDROID_ARM_MODE}" "-DANDROID_ARM_NEON=${ANDROID_ARM_NEON}" "-DANDROID_LD=${ANDROID_LD}" "-DANDROID_PLATFORM=${ANDROID_PLATFORM}" "-DANDROID_STL=${ANDROID_STL}")
+ endif()
try_compile(USERUNTIME
"${CMAKE_BINARY_DIR}/CMake"
"${CMAKE_CURRENT_LIST_DIR}/CMake"
test_cxx_runtime
- CMAKE_FLAGS "-DCXX_RUNTIME=${CXX_RUNTIME_LIB}")
+ CMAKE_FLAGS "-DCXX_RUNTIME=${CXX_RUNTIME_LIB}" ${CXX_RUNTIME_FLAGS})
if (USERUNTIME)
set(CXX_RUNTIME ${CXX_RUNTIME_LIB} PARENT_SCOPE)
endif()
