I failed to find_library with cmake/android, so I wrote this simple test.
find_library(log-lib log
PATHS /Users/sam/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm/usr/lib
NO_DEFAULT_PATH)
It's Ok. Then I copy that lib directory to another location.
find_library(log-lib log
PATHS /Users/sam/tmp/lib
NO_DEFAULT_PATH)
Fail! I am pretty sure that I have copied the whole lib directory.
Any ideas? Thanks in advance.
Since you are cross-compiling, you must tell CMake
that it is allowed to use a library elsewhere than specified by the toolchain (in your case, elsewhere than the Android SDK directory).
To do so, you can add this:
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
(in your case, only the first one is relevant)
More information here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With