diff options
author | Brad King <brad.king@kitware.com> | 2017-01-24 19:45:32 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-01-24 19:45:32 (GMT) |
commit | 38bb96386cdc331d6fd080166318ff8272fc19eb (patch) | |
tree | 5cc8bca690629136a62a717a71bea5bc72b82d64 | |
parent | 6122fc54a9275caf3054a12bbc813be2c8036863 (diff) | |
parent | 1ee0ffab819d632d7570bee23a83807facbb45a2 (diff) | |
download | CMake-38bb96386cdc331d6fd080166318ff8272fc19eb.zip CMake-38bb96386cdc331d6fd080166318ff8272fc19eb.tar.gz CMake-38bb96386cdc331d6fd080166318ff8272fc19eb.tar.bz2 |
Merge topic 'android-include-api'
1ee0ffab Android: Pass sysroot include directory explicitly
1806e011 Android: Fix c++_{static,shared} support include directory order
-rw-r--r-- | Modules/Platform/Android-Common.cmake | 9 | ||||
-rw-r--r-- | Modules/Platform/Android/ndk-stl-c++.cmake | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Modules/Platform/Android-Common.cmake b/Modules/Platform/Android-Common.cmake index 8755d4f..cf2785a 100644 --- a/Modules/Platform/Android-Common.cmake +++ b/Modules/Platform/Android-Common.cmake @@ -149,4 +149,13 @@ macro(__android_compiler_common lang) if("x${lang}" STREQUAL "xCXX") __android_stl(CXX) endif() + + # <ndk>/build/core/definitions.mk appends the sysroot's include directory + # explicitly at the end of the command-line include path so that it + # precedes the toolchain's builtin include directories. This is + # 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") endmacro() diff --git a/Modules/Platform/Android/ndk-stl-c++.cmake b/Modules/Platform/Android/ndk-stl-c++.cmake index b27015d..a12411c 100644 --- a/Modules/Platform/Android/ndk-stl-c++.cmake +++ b/Modules/Platform/Android/ndk-stl-c++.cmake @@ -6,16 +6,15 @@ macro(__android_stl_cxx lang filename) if(EXISTS "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef") # r12 and below __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" 1) else() # r13 and above __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/include" 1) endif() - # Add a secondary include directory if it exists. - __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) - # Add the library file. __android_stl_lib(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${CMAKE_ANDROID_ARCH_ABI}/${filename}" 1) endmacro() |