title: Android NDK tries to link library with pthread even though I didnt add it
body: <p>This is the output of the SDK when it tries to link my project:</p>
  <pre><code>  : &amp;&amp; /home/user/Android/Sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi24 --gcc-toolchain=/home/user/Android/Sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Android/Sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -std=c++17 -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,liborwell_android.so -o /home/user/orwell2/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/liborwell_android.so CMakeFiles/orwell_android.dir/orwell_jni.cpp.o CMakeFiles/orwell_android.dir/DecodedFfmpegFrameJNI.cpp.o CMakeFiles/orwell_android.dir/JavaOrwellFlutterRenderer.cpp.o CMakeFiles/orwell_android.dir/MediaCodecDecoder.cpp.o CMakeFiles/orwell_android.dir/JavaSimpleFileWriter.cpp.o CMakeFiles/orwell_android.dir/JavaHashMapJNI.cpp.o CMakeFiles/orwell_android.dir/JavaFlutterEventMessenger.cpp.o  _liborwell/liborwell_static.a -landroid /home/user/Android/Sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/24/liblog.so -lmediandk /home/user/orwell2/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libavcodec.so /home/user/orwell2/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libavutil.so /home/user/orwell2/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libswscale.so /home/user/orwell2/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libswresample.so -llog /home/user/orwell2/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/libmyRtspClient.so /home/user/orwell2/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/libjrtp.so _liborwell/_myRtspClient/libmyRtspClient-static.a _liborwell/_myRtspClient/_JTRPLIB/src/libjrtp.a _liborwell/_ZLMediaKit/libzlmediakit.a _liborwell/_ZLMediaKit/libzltoolkit.a _liborwell/_ZLMediaKit/libmpeg.a _liborwell/_ZLMediaKit/libmov.a _liborwell/_ZLMediaKit/libflv.a _liborwell/common/openvpn_zl_socket/libopenvpn_zl_socket.a _liborwell/common/openvpn_myrtsp_socket/libmyrtsp_vpn_tcp_transmitter.a _liborwell/_libopenvpn3/src/libopenvpn/libopenvpn_lib.a _liborwell/_libopenvpn3/openvpn3/libssl.a _liborwell/_libopenvpn3/openvpn3/libcrypto.a -lpthread _liborwell/_libopenvpn3/openvpn3/liblzo.a _liborwell/_libopenvpn3/openvpn3/liblz4.a _liborwell/_libopenvpn3/libtins/lib/libtins.a _liborwell/_libopenvpn3/smoltcp_cpp_interface/libsmoltcp_cpp_static.a /home/user/orwell2/deps/libopenvpn3/smoltcp_cpp_interface/target/debug/libsmoltcp_cpp_interface_rust.a -ldl _liborwell/common/liborwellebml/liborwell_ebml.a _liborwell/_libebml/libebml.a _liborwell/common/liborwellprofile/liborwell_profile.a -latomic -lm &amp;&amp; :
  </code></pre>
  <p>and then I get</p>
  <pre><code> /home/user/Android/Sdk/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lpthread
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
  </code></pre>
  <p>I don't know why it's linking wth pthread since I did NOT include pthread in the CMakeLists.txt:</p>
  <pre><code>cmake_minimum_required(VERSION 3.6)
  add_compile_options(-D ANDROID)
  set(COMPILE_TARGET ANDROID)
  
  project(orwell_android)
  
  set(FLAVOR ANDROID)
  
  #temporary quirk for libtins
  set(OPENSSL_INCLUDE_DIR &quot;&quot;)
  
  set(ORWELL_ANDROID_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../..)
  set(DEPENDENCIES ${ORWELL_ANDROID_PROJECT_ROOT}/deps/)
  
  add_subdirectory(${ORWELL_ANDROID_PROJECT_ROOT}/liborwell/ _liborwell)
  
  include(${ORWELL_ANDROID_PROJECT_ROOT}/liborwell/ORWELL_INCLUDES.cmake)
  include_directories(${LIBORWELL_INCLUDE_DIRS})
  
  find_library(log_library log)
  
  file(GLOB ORWELL_ANDROID_SOURCES 
  &quot;orwell_jni.cpp&quot; 
  &quot;DecodedFfmpegFrameJNI.cpp&quot;
  &quot;JavaOrwellFlutterRenderer.cpp&quot; 
  &quot;MediaCodecDecoder.cpp&quot; 
  &quot;JavaSimpleFileWriter.cpp&quot; 
  &quot;JavaHashMapJNI.cpp&quot; 
  &quot;JavaFlutterEventMessenger.cpp&quot;)
  
  include_directories(${CMAKE_CURRENT_SOURCE_DIR})
  
  set(FFMPEG_INCLUDE_DIR ${ORWELL_ANDROID_PROJECT_ROOT}/deps/ffmpeg/build/android/${ANDROID_ABI}/include)
  include_directories(${FFMPEG_INCLUDE_DIR})
  set(FFMPEG_LIB_DIR ${ORWELL_ANDROID_PROJECT_ROOT}/deps/ffmpeg/build/android/${ANDROID_ABI}/lib)
  
  add_library(libavcodec SHARED IMPORTED)
  set_target_properties(libavcodec PROPERTIES IMPORTED_LOCATION ${FFMPEG_LIB_DIR}/libavcodec.so)
  add_library(libavutil SHARED IMPORTED)
  set_target_properties(libavutil PROPERTIES IMPORTED_LOCATION ${FFMPEG_LIB_DIR}/libavutil.so)
  add_library(libswscale SHARED IMPORTED)
  set_target_properties(libswscale PROPERTIES IMPORTED_LOCATION ${FFMPEG_LIB_DIR}/libswscale.so)
  add_library(libswresample SHARED IMPORTED)
  set_target_properties(libswresample PROPERTIES IMPORTED_LOCATION ${FFMPEG_LIB_DIR}/libswresample.so)
  
  
  add_library(orwell_android SHARED ${ORWELL_ANDROID_SOURCES})
  add_dependencies(orwell_android orwell_static libavcodec libavutil libswscale libswresample)
  target_link_libraries(orwell_android orwell_static android ${log_library} mediandk libavcodec libavutil libswscale libswresample)
  </code></pre>
  <p>You can see that the NDK is trying to link <code>liborwell_android</code> which is what I have here, ad it does not include <code>libpthread</code> in <code>target_link_libraries</code>.</p>
  <p>I know that pthread isn't needed for Android, so how can I force it to not include pthread?</p>