diff options
author | Gabriel Souza Franco <gabrielfrancosouza@gmail.com> | 2020-09-20 21:03:30 -0300 |
---|---|---|
committer | Gabriel Souza Franco <gabrielfrancosouza@gmail.com> | 2020-09-20 21:03:30 -0300 |
commit | fbc00bf4b570d7ec02c0855d5133dde38c5b91eb (patch) | |
tree | cd06196111d59db8d9fa0fcc17b5f3fb9e36fc20 /toolchain | |
parent | b2e4ee878f55c193f009aac7ebad6013696c6683 (diff) | |
download | extra-cmake-modules-fbc00bf4b570d7ec02c0855d5133dde38c5b91eb.tar.gz extra-cmake-modules-fbc00bf4b570d7ec02c0855d5133dde38c5b91eb.tar.bz2 |
Fix configuring with pthread on Android 32 bit
Diffstat (limited to 'toolchain')
-rw-r--r-- | toolchain/Android.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/toolchain/Android.cmake b/toolchain/Android.cmake index 39e15495..80720711 100644 --- a/toolchain/Android.cmake +++ b/toolchain/Android.cmake @@ -160,6 +160,18 @@ if (NOT CMAKE_ANDROID_STL_TYPE) set(CMAKE_ANDROID_STL_TYPE c++_shared) endif() +# Workaround link failure at FindThreads in CXX-only mode, +# armv7 really doesn't like mixing PIC/PIE code. +# Since we only have to care about a single compiler, +# hard-code the values here. +if (NOT TARGET Threads::Threads) + set(Threads_FOUND TRUE) + set(CMAKE_THREAD_LIBS_INIT "-pthread") + add_library(Threads::Threads INTERFACE IMPORTED) + set_property(TARGET Threads::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread") + set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "-pthread") +endif() + # let the Android NDK toolchain file do the actual work set(ANDROID_PLATFORM "android-${CMAKE_ANDROID_API}") set(ANDROID_STL ${CMAKE_ANDROID_STL_TYPE}) |