summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudioVersionedGenerator.cxx38
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx25
2 files changed, 35 insertions, 28 deletions
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index e9c8254..be318c1 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -802,26 +802,28 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset(
"*/Microsoft.VCToolsVersion."_s, twoComponent, "*.txt"_s);
cmsys::Glob glob;
glob.SetRecurseThroughSymlinks(false);
- // Since we are only using the first two components of the toolset version,
- // we require a definite match
- if (glob.FindFiles(pattern) && glob.GetFiles().size() == 1) {
- std::string const& txt = glob.GetFiles()[0];
- std::string ver;
- cmsys::ifstream fin(txt.c_str());
- if (fin && std::getline(fin, ver)) {
- // Strip trailing whitespace.
- ver = ver.substr(0, ver.find_first_not_of("0123456789."));
- // We assume the version is correct, since it is the only one that
- // matched.
- cmsys::RegularExpression extractVersion(
- "VCToolsVersion\\.([0-9.]+)\\.txt$");
- if (extractVersion.find(txt)) {
- version = extractVersion.match(1);
+ if (glob.FindFiles(pattern) && !glob.GetFiles().empty()) {
+ // Since we are only using the first two components of the
+ // toolset version, we require a single match.
+ if (glob.GetFiles().size() == 1) {
+ std::string const& txt = glob.GetFiles()[0];
+ std::string ver;
+ cmsys::ifstream fin(txt.c_str());
+ if (fin && std::getline(fin, ver)) {
+ // Strip trailing whitespace.
+ ver = ver.substr(0, ver.find_first_not_of("0123456789."));
+ // We assume the version is correct, since it is the only one that
+ // matched.
+ cmsys::RegularExpression extractVersion(
+ "VCToolsVersion\\.([0-9.]+)\\.txt$");
+ if (extractVersion.find(txt)) {
+ version = extractVersion.match(1);
+ }
}
+ } else {
+ props = cmStrCat(instancePath, "/VC/Auxiliary/Build/"_s);
+ return AuxToolset::PropsIndeterminate;
}
- } else {
- props = cmStrCat(instancePath, "/VC/Auxiliary/Build/"_s);
- return AuxToolset::PropsIndeterminate;
}
}
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 67b6e92..0658021 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2390,13 +2390,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Choose a language to use for target-wide preprocessor definitions.
static const char* ppLangs[] = { "CXX", "C", "OBJCXX", "OBJC" };
- std::string langForPreprocessor;
+ std::string langForPreprocessorDefinitions;
if (cm::contains(ppLangs, llang)) {
- langForPreprocessor = llang;
+ langForPreprocessorDefinitions = llang;
} else {
for (const char* l : ppLangs) {
if (languages.count(l)) {
- langForPreprocessor = l;
+ langForPreprocessorDefinitions = l;
break;
}
}
@@ -2424,9 +2424,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->AppendDefines(ppDefs, exportMacro->c_str());
}
std::vector<std::string> targetDefines;
- if (!langForPreprocessor.empty()) {
+ if (!langForPreprocessorDefinitions.empty()) {
gtgt->GetCompileDefinitions(targetDefines, configName,
- langForPreprocessor);
+ langForPreprocessorDefinitions);
}
this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute("GCC_PREPROCESSOR_DEFINITIONS",
@@ -2725,10 +2725,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString sysfdirs(this, true);
const bool emitSystemIncludes = this->XcodeVersion >= 83;
+ // Choose a language to use for target-wide include directories.
+ std::string const& langForIncludes = llang;
std::vector<std::string> includes;
- if (!langForPreprocessor.empty()) {
+ if (!langForIncludes.empty()) {
this->CurrentLocalGenerator->GetIncludeDirectories(
- includes, gtgt, langForPreprocessor, configName);
+ includes, gtgt, langForIncludes, configName);
}
std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks");
@@ -2741,7 +2743,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string incpath = this->XCodeEscapePath(frameworkDir);
if (emitSystemIncludes &&
gtgt->IsSystemIncludeDirectory(include, configName,
- langForPreprocessor)) {
+ langForIncludes)) {
sysfdirs.Add(incpath);
} else {
fdirs.Add(incpath);
@@ -2751,7 +2753,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string incpath = this->XCodeEscapePath(include);
if (emitSystemIncludes &&
gtgt->IsSystemIncludeDirectory(include, configName,
- langForPreprocessor)) {
+ langForIncludes)) {
sysdirs.Add(incpath);
} else {
dirs.Add(incpath);
@@ -2765,7 +2767,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string incpath = this->XCodeEscapePath(fwDir);
if (emitSystemIncludes &&
gtgt->IsSystemIncludeDirectory(fwDir, configName,
- langForPreprocessor)) {
+ langForIncludes)) {
sysfdirs.Add(incpath);
} else {
fdirs.Add(incpath);
@@ -2778,6 +2780,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
if (!dirs.IsEmpty()) {
buildSettings->AddAttribute("HEADER_SEARCH_PATHS", dirs.CreateList());
+ if (languages.count("Swift")) {
+ buildSettings->AddAttribute("SWIFT_INCLUDE_PATHS", dirs.CreateList());
+ }
}
if (!sysfdirs.IsEmpty()) {
buildSettings->AddAttribute("SYSTEM_FRAMEWORK_SEARCH_PATHS",