diff options
author | Brad King <brad.king@kitware.com> | 2017-04-21 12:50:17 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-04-21 12:50:35 (GMT) |
commit | bcf066435ca30a685002bcfbc6677eaaa74a6190 (patch) | |
tree | ab11ed401ee61385747a1637c9823fafae3db557 | |
parent | 2b7aecba1663f86148b8c2f1033cfcbd87453ad3 (diff) | |
parent | ffdde4a9aeb7a93f1f608d92e15540a7ca43a1e6 (diff) | |
download | CMake-bcf066435ca30a685002bcfbc6677eaaa74a6190.zip CMake-bcf066435ca30a685002bcfbc6677eaaa74a6190.tar.gz CMake-bcf066435ca30a685002bcfbc6677eaaa74a6190.tar.bz2 |
Merge topic '16795-xcode-system-header-search-paths'
ffdde4a9 Xcode: Use SYSTEM_HEADER_SEARCH_PATHS attribute for system includes
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !726
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 8c1c0e7..6118c73 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2009,6 +2009,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); + BuildObjectListOrString sysdirs(this, this->XcodeVersion >= 30); + BuildObjectListOrString sysfdirs(this, this->XcodeVersion >= 30); + const bool emitSystemIncludes = this->XcodeVersion >= 83; + std::vector<std::string> includes; this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", configName); @@ -2022,11 +2026,22 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, frameworkDir += "/../"; frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); if (emitted.insert(frameworkDir).second) { - fdirs.Add(this->XCodeEscapePath(frameworkDir)); + std::string incpath = this->XCodeEscapePath(frameworkDir); + if (emitSystemIncludes && + gtgt->IsSystemIncludeDirectory(frameworkDir, configName)) { + sysfdirs.Add(incpath); + } else { + fdirs.Add(incpath); + } } } else { std::string incpath = this->XCodeEscapePath(*i); - dirs.Add(incpath); + if (emitSystemIncludes && + gtgt->IsSystemIncludeDirectory(*i, configName)) { + sysdirs.Add(incpath); + } else { + dirs.Add(incpath); + } } } // Add framework search paths needed for linking. @@ -2035,7 +2050,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, for (std::vector<std::string>::const_iterator fdi = fwDirs.begin(); fdi != fwDirs.end(); ++fdi) { if (emitted.insert(*fdi).second) { - fdirs.Add(this->XCodeEscapePath(*fdi)); + std::string incpath = this->XCodeEscapePath(*fdi); + if (emitSystemIncludes && + gtgt->IsSystemIncludeDirectory(*fdi, configName)) { + sysfdirs.Add(incpath); + } else { + fdirs.Add(incpath); + } } } } @@ -2045,8 +2066,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, if (!dirs.IsEmpty()) { buildSettings->AddAttribute("HEADER_SEARCH_PATHS", dirs.CreateList()); } + if (!sysfdirs.IsEmpty()) { + buildSettings->AddAttribute("SYSTEM_FRAMEWORK_SEARCH_PATHS", + sysfdirs.CreateList()); + } + if (!sysdirs.IsEmpty()) { + buildSettings->AddAttribute("SYSTEM_HEADER_SEARCH_PATHS", + sysdirs.CreateList()); + } - if (this->XcodeVersion >= 60) { + if (this->XcodeVersion >= 60 && !emitSystemIncludes) { // Add those per-language flags in addition to HEADER_SEARCH_PATHS to gain // system include directory awareness. We need to also keep on setting // HEADER_SEARCH_PATHS to work around a missing compile options flag for |