I am using android-cmake to compile an android application. This essentially creates a CMake toolchain file to use the tool chain that comes with the Android NDK.
As in this related question , I am having problems with the following line in the CMakeLists.txt file:
find_package(Threads REQUIRED)
The header file is in
~/Android/android-ndk-r7/platforms/android-8/arch-arm/usr/include/pthread.h
The library file is in
~/Android/android-ndk-r7/platforms/android-8/arch-arm/usr/lib/libthread_db.so
The problem is that FindThreads.cmake calls CHECK_INCLUDE_FILES("pthread.h", CMAKE_HAVE_PTHREAD_H)
, and this does not seem to bother checking in this directory.
According to the CMake useful variables wiki page , CMAKE_LIBRARY_PATH
allows CMAKE_LIBRARY_PATH
to set the title search path, CMAKE_LIBRARY_PATH
allows CMAKE_LIBRARY_PATH
to set the library search path, and CMAKE_PREFIX_PATH
appears as for find_package.
However, despite the fact that I set environment variables before running cmake ...
export CMAKE_INCLUDE_PATH=~/Android/android-ndk-r7/platforms/android-8/arch-arm/usr:~/Android/android-ndk-r7/platforms/android-8/arch-arm/usr/include
... or I install them directly in CMakeLists.txt ...
if(ANDROID) set(CMAKE_INCLUDE_PATH ${ANDROID_NDK_SYSROOT}/usr ${ANDROID_NDK_SYSROOT}/usr/include ${CMAKE_INCLUDE_PATH} ) set(CMAKE_LIBRARY_PATH ${ANDROID_NDK_SYSROOT}/usr ${ANDROID_NDK_SYSROOT}/usr/lib ${CMAKE_LIBRARY_PATH}) set(CMAKE_PREFIX_PATH ${ANDROID_NDK_SYSROOT} ${CMAKE_PREFIX_PATH}) message(${ANDROID_NDK_SYSROOT}) message(${CMAKE_INCLUDE_PATH}) endif() find_package(Threads REQUIRED)
... (and this runs, messages are printed) and where ${ANDROID_NDK_SYSROOT}
contains
/Users/martin/Android/android-ndk-r7/platforms/android-8/arch-arm
I'm still getting a message
Could not find threads (missing: Threads_FOUND)
Does anyone have any suggestions regarding what I am doing wrong?