Skip to content

Android: Always add standard include directories last

Brad King requested to merge brad.king/cmake:android-system-include-last into master

The logic added in commit c1340827 to use CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES incorrectly filters them by CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES. Rather than recognizing this, !418 (merged) worked around the problem by incorrectly removing /usr/include from CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES so it worked in CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES.

By not filtering out /usr/include from user-specified include directories, we allow the code


to place the include directory too early on the command line.

Fix support for standard include directories to not be filtered by implicit include directories, and do not remove /usr/include from the list of implicit include directories for Android builds. Add a test case to verify that an explicit /usr/include is ignored in favor of the standard directory at the end.

Fixes: #17059 (closed)

Edited by Brad King

Merge request reports