Skip to content
  • Haibo Huang's avatar
    Android: restructure android search paths · cbc51a8b
    Haibo Huang authored and Brad King's avatar Brad King committed
    1. Set CMAKE_FIND_ROOT_PATH unconditionally.
    
    Revise the implementation from commit a7f41a7e (Android: Fix find_*
    search order within NDK for unified toolchains, 2020-10-13).  In the old
    implementation, if people set CMAKE_FIND_ROOT_PATH, 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.
    
    2. Add api level specific library path to CMAKE_SYSTEM_PREFIX_PATH.
    
    As the discussion in [1], some people want the paths added by
    UnixPaths.cmake. They install their libraries according to
    GNUInstallDirs [2].
    
    As a result, we cannot clear CMAKE_SYSTEM_PREFIX_PATH. It includes /usr
    so no matter what we specify in CMAKE_SYSTEM_LIBRARY_PATH,
    /usr/lib/<arch> will be searched first.
    
    The author also pointed out a way to solve this issue [3]. In addition
    to other paths, CMake also searches <root>/<prefix> [4]. So we can add
    the API specific lib path to the beginning of CMAKE_SYSTEM_PREFIX_PATH...
    cbc51a8b