Browse Source

Merge topic 'android-standalone-no-sysroot-include'

22f8a465 Android: Do not pass sysroot include for standalone toolchain

Acked-by: Kitware Robot <[email protected]>
Merge-request: !952
Brad King 8 years ago
parent
commit
f6ed92280c
1 changed files with 7 additions and 2 deletions
  1. 7 2
      Modules/Platform/Android-Common.cmake

+ 7 - 2
Modules/Platform/Android-Common.cmake

@@ -156,6 +156,11 @@ macro(__android_compiler_common lang)
   # necessary so that Android API-version-specific headers are preferred
   # over those in the toolchain's `include-fixed` directory (which cannot
   # possibly match all versions).
-  list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/usr/include")
-  list(REMOVE_ITEM CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include")
+  #
+  # Do not do this for a standalone toolchain because it is already
+  # tied to a specific API version.
+  if(CMAKE_ANDROID_NDK)
+    list(APPEND CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_SYSROOT}/usr/include")
+    list(REMOVE_ITEM CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include")
+  endif()
 endmacro()