Android: restructure android search paths
- Sets CMAKE_FIND_ROOT_PATH unconditionally.
In the old implementation, if people set
CMAKE_ANDROID_NDK won't be added to find root. And all paths added to
CMAKE_SYSTEM_*_PATH below will be rerooted to the user specified root.
- Adds api level specific library path to CMAKE_SYSTEM_PREFIX_PATH.
As the discussion in , some people want the paths added by UnixPaths.cmake. They install their libraries according to GNUInstallDirs .
As a result, we can not clear
CMAKE_SYSTEM_PREFIX_PATH. It includes /usr so no matter what we specify in
CMAKE_SYSTEM_LIBRARY_PATH, /usr/lib/ will be searched first.
The author also pointed out a way to solve this issue . In addition to other paths, CMake also searches
lib/<arch> suffix . So we can add the API specific lib path to the beginning of
CMAKE_SYSTEM_PREFIX_PATH, to have it searched first.