diff options
author | Brad King <brad.king@kitware.com> | 2017-07-12 15:37:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-07-13 14:03:58 (GMT) |
commit | 4bafa3922e3773e5bcc6741994379455c7d1c0fc (patch) | |
tree | 9f3ddb30fb1823474ffd1c327f4252bedbff62d2 /Source | |
parent | 25b72e9097260d1faf254155a1199886c808a58f (diff) | |
download | CMake-4bafa3922e3773e5bcc6741994379455c7d1c0fc.zip CMake-4bafa3922e3773e5bcc6741994379455c7d1c0fc.tar.gz CMake-4bafa3922e3773e5bcc6741994379455c7d1c0fc.tar.bz2 |
Android: Always add standard include directories last
The logic added in commit v3.6.0-rc1~30^2 (Add a variable to specify
language-wide system include directories, 2016-05-24) to use
`CMAKE_<LANG>_STANDARD_INCLUDE_DIRECTORIES` incorrectly filters them by
`CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES`. Rather than recognizing
this, commit v3.8.0-rc1~60^2 (Android: Pass sysroot include directory
explicitly, 2017-01-20) 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
include_directories(${CMAKE_SYSROOT}/usr/include)
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
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 12 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 14 |
2 files changed, 14 insertions, 12 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b93442d..1802da4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2633,18 +2633,6 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( cmDeleteAll(linkInterfaceIncludeDirectoriesEntries); - // Add standard include directories for this language. - std::string const standardIncludesVar = - "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES"; - std::string const standardIncludes = - this->Makefile->GetSafeDefinition(standardIncludesVar); - std::vector<std::string>::size_type const before = includes.size(); - cmSystemTools::ExpandListArgument(standardIncludes, includes); - for (std::vector<std::string>::iterator i = includes.begin() + before; - i != includes.end(); ++i) { - cmSystemTools::ConvertToUnixSlashes(*i); - } - return includes; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 8e00303..5a062bc 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -916,6 +916,20 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, } } + // Add standard include directories for this language. + // We do not filter out implicit directories here. + std::string const standardIncludesVar = + "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES"; + std::string const standardIncludes = + this->Makefile->GetSafeDefinition(standardIncludesVar); + std::vector<std::string>::size_type const before = includes.size(); + cmSystemTools::ExpandListArgument(standardIncludes, includes); + for (std::vector<std::string>::iterator i = includes.begin() + before; + i != includes.end(); ++i) { + cmSystemTools::ConvertToUnixSlashes(*i); + dirs.push_back(*i); + } + for (std::vector<std::string>::const_iterator i = implicitDirs.begin(); i != implicitDirs.end(); ++i) { if (std::find(includes.begin(), includes.end(), *i) != includes.end()) { |