summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Android-Common.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-08-03 16:03:59 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-03 16:03:59 (GMT)
commit68d67c827fceabc22bb0be76f084391659dc9a28 (patch)
tree70f683b4e8cb50f0df7666af94595d7d450e00f5 /Modules/Platform/Android-Common.cmake
parentf15cfd891d1e01247ed285320ae32b6c3182ac8f (diff)
downloadCMake-68d67c827fceabc22bb0be76f084391659dc9a28.zip
CMake-68d67c827fceabc22bb0be76f084391659dc9a28.tar.gz
CMake-68d67c827fceabc22bb0be76f084391659dc9a28.tar.bz2
Android: Fix support for CMAKE_SYSROOT without CMAKE_SYSROOT_COMPILE
If `CMAKE_SYSROOT` is set by the user (e.g. via the toolchain file) then we do not set `CMAKE_SYSROOT_COMPILE` to our default. Fix our references to the sysroot's `/usr/include` directory to use `CMAKE_SYSROOT_COMPILE` only if it is set and else `CMAKE_SYSROOT`. Fixes: #17096
Diffstat (limited to 'Modules/Platform/Android-Common.cmake')
-rw-r--r--Modules/Platform/Android-Common.cmake12
1 files changed, 9 insertions, 3 deletions
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake
index 5faada3..80a8f41 100644
--- a/Modules/Platform/Android-Common.cmake
+++ b/Modules/Platform/Android-Common.cmake
@@ -160,13 +160,19 @@ macro(__android_compiler_common lang)
# Do not do this for a standalone toolchain because it is already
# tied to a specific API version.
if(CMAKE_ANDROID_NDK)
+ if(CMAKE_SYSROOT_COMPILE)
+ set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}")
+ else()
+ set(_cmake_sysroot_compile "${CMAKE_SYSROOT}")
+ endif()
if(NOT CMAKE_ANDROID_NDK_DEPRECATED_HEADERS)
list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES
- "${CMAKE_SYSROOT_COMPILE}/usr/include"
- "${CMAKE_SYSROOT_COMPILE}/usr/include/${CMAKE_ANDROID_ARCH_HEADER_TRIPLE}"
+ "${_cmake_sysroot_compile}/usr/include"
+ "${_cmake_sysroot_compile}/usr/include/${CMAKE_ANDROID_ARCH_HEADER_TRIPLE}"
)
else()
- list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/usr/include")
+ list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${_cmake_sysroot_compile}/usr/include")
endif()
+ unset(_cmake_sysroot_compile)
endif()
endmacro()