diff options
author | Brad King <brad.king@kitware.com> | 2018-04-03 15:31:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-03 18:34:57 (GMT) |
commit | 843d55de295b0eeca2a028badde3b2f9a409cc72 (patch) | |
tree | 3ef22b1de380da49007e6fd5eb7684f51386868a /Modules/Platform/Android-Clang-CXX.cmake | |
parent | 12e6796b6289dbc910b9b7fe57f6b564edbc46dd (diff) | |
download | CMake-843d55de295b0eeca2a028badde3b2f9a409cc72.zip CMake-843d55de295b0eeca2a028badde3b2f9a409cc72.tar.gz CMake-843d55de295b0eeca2a028badde3b2f9a409cc72.tar.bz2 |
Android: Suppress implicit -lstdc++ linker flag
The chosen STL libraries are already linked explicitly so we shouldn't
let the compiler add its implicit `-lstdc++` (the default) when invoking
the linker.
Fixes: #17863
NDK-Issue: https://github.com/android-ndk/ndk/issues/105
Inspired-by: Tom Hughes <tomtheengineer@gmail.com>
Diffstat (limited to 'Modules/Platform/Android-Clang-CXX.cmake')
-rw-r--r-- | Modules/Platform/Android-Clang-CXX.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/Platform/Android-Clang-CXX.cmake b/Modules/Platform/Android-Clang-CXX.cmake index 7111836..85d5088 100644 --- a/Modules/Platform/Android-Clang-CXX.cmake +++ b/Modules/Platform/Android-Clang-CXX.cmake @@ -1,2 +1,9 @@ include(Platform/Android-Clang) __android_compiler_clang(CXX) +if(_ANDROID_STL_NOSTDLIBXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6) + string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -nostdlib++") + else() + string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -nodefaultlibs -lgcc -lc -lm -ldl") + endif() +endif() |