summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2016-06-01 19:07:08 -0700
committerChaoren Lin <chaorenl@google.com>2016-06-01 19:07:08 -0700
commit4d84ac860b03594dcf5b5a2544169c7609b82cc3 (patch)
treed1dcfc15cc26796c3688e6b0fe7a9ed5d93a253b
parent2b33072db5633fb7561ea030e0fdf2b54c61fb7a (diff)
downloadandroid-cmake-cmake-master-dev.tar.gz
Allow searching for libraries and headers on arbitrary host paths.cmake-master-dev
Change-Id: Iab2aa3c03f7946be72c38cb68e10812c318d4acb
-rw-r--r--README.google1
-rw-r--r--android.toolchain.cmake55
2 files changed, 7 insertions, 49 deletions
diff --git a/README.google b/README.google
index 966687d..2672cc1 100644
--- a/README.google
+++ b/README.google
@@ -9,3 +9,4 @@ Local Modifications:
distribution.
- Added build ID for debugging.
- Change default API level from 8 to 9.
+- Allow Android libraries and headers located outside of the target sysroot.
diff --git a/android.toolchain.cmake b/android.toolchain.cmake
index 04ed7b2..bb14d2b 100644
--- a/android.toolchain.cmake
+++ b/android.toolchain.cmake
@@ -1525,55 +1525,12 @@ set( BUILD_ANDROID True )
# where is the target environment
set( CMAKE_FIND_ROOT_PATH "${ANDROID_TOOLCHAIN_ROOT}/bin" "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}" "${ANDROID_SYSROOT}" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/share" )
-# only search for libraries and includes in the ndk toolchain
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-
-
-# macro to find packages on the host OS
-macro( find_host_package )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
- if( CMAKE_HOST_WIN32 )
- SET( WIN32 1 )
- SET( UNIX )
- elseif( CMAKE_HOST_APPLE )
- SET( APPLE 1 )
- SET( UNIX )
- endif()
- find_package( ${ARGN} )
- SET( WIN32 )
- SET( APPLE )
- SET( UNIX 1 )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-endmacro()
-
-
-# macro to find programs on the host OS
-macro( find_host_program )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
- if( CMAKE_HOST_WIN32 )
- SET( WIN32 1 )
- SET( UNIX )
- elseif( CMAKE_HOST_APPLE )
- SET( APPLE 1 )
- SET( UNIX )
- endif()
- find_program( ${ARGN} )
- SET( WIN32 )
- SET( APPLE )
- SET( UNIX 1 )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-endmacro()
-
+# only use host programs
+set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
+# search for libraries and headers based on target sysroot first,
+# but also allow searching in arbitrary host paths
+set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )
+set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )
# export toolchain settings for the try_compile() command
if( NOT _CMAKE_IN_TRY_COMPILE )