android.toolchain.cmake: restore implicit link with math library for C++ objects

Ticket #2426
This commit is contained in:
Andrey Kamaev 2012-10-11 16:10:01 +04:00
parent 7cb525d63f
commit c46affe63e

View File

@ -231,6 +231,12 @@
# [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
# [+] added support for all C++ runtimes from NDK
# (system, gabi++, stlport, gnustl)
# [+] improved warnings on known issues of NDKs
# [~] use gold linker as default if available (NDK r8b)
# [~] globally turned off rpath
# [~] compiler options are aligned with NDK r8b
# - modified October 2012
# [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
# ------------------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6.3 )
@ -1091,6 +1097,11 @@ if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
set( CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_C_CREATE_SHARED_MODULE} \"${__libsupcxx}\"" )
set( CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} \"${__libsupcxx}\"" )
endif()
if( ANDROID_STL MATCHES "gnustl" )
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} -lm" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} -lm" )
set( CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lm" )
endif()
endif()
# variables controlling optional build flags