diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2017-04-19 20:17:35 (GMT) |
---|---|---|
committer | Gregor Jasny <gjasny@googlemail.com> | 2017-04-19 20:28:50 (GMT) |
commit | ffdde4a9aeb7a93f1f608d92e15540a7ca43a1e6 (patch) | |
tree | ce573e112862f3c2da2c71d2c6e3ad1b2efa0ecb /Source/cmGlobalXCodeGenerator.cxx | |
parent | 44f0d2d9913595e214048b6d5a2b9ab2e9d1cf46 (diff) | |
download | CMake-ffdde4a9aeb7a93f1f608d92e15540a7ca43a1e6.zip CMake-ffdde4a9aeb7a93f1f608d92e15540a7ca43a1e6.tar.gz CMake-ffdde4a9aeb7a93f1f608d92e15540a7ca43a1e6.tar.bz2 |
Xcode: Use SYSTEM_HEADER_SEARCH_PATHS attribute for system includes
Closes #16795
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-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 |