summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx84
1 files changed, 58 insertions, 26 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 433edaf..9739a4e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -468,6 +468,10 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir,
}
CFRelease(cfStr);
}
+#else
+ (void)bindir;
+ (void)projectName;
+ (void)dryRun;
#endif
return ret;
@@ -1188,13 +1192,9 @@ std::string GetTargetObjectDirArch(T const& target,
std::string cmGlobalXCodeGenerator::GetLibraryOrFrameworkPath(
const std::string& path) const
{
- auto fwItems = this->SplitFrameworkPath(path);
- if (fwItems) {
- if (fwItems->first.empty()) {
- return cmStrCat(fwItems->second, ".framework");
- } else {
- return cmStrCat(fwItems->first, '/', fwItems->second, ".framework");
- }
+ auto fwDescriptor = this->SplitFrameworkPath(path);
+ if (fwDescriptor) {
+ return fwDescriptor->GetFrameworkPath();
}
return path;
@@ -1372,6 +1372,18 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
return true;
}
+ for (std::string const& configName : this->CurrentConfigurationTypes) {
+ gtgt->CheckCxxModuleStatus(configName);
+ }
+
+ if (gtgt->HaveCxx20ModuleSources()) {
+ gtgt->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat("The \"", gtgt->GetName(),
+ "\" target contains C++ module sources which are not "
+ "supported by the generator"));
+ }
+
auto& gtgt_visited = this->CommandsVisited[gtgt];
auto& deps = this->GetTargetDirectDepends(gtgt);
for (auto& d : deps) {
@@ -2352,8 +2364,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string& flags = cflags[lang];
// Add language-specific flags.
- this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang,
- configName);
+ this->CurrentLocalGenerator->AddLanguageFlags(
+ flags, gtgt, cmBuildStep::Compile, lang, configName);
if (gtgt->IsIPOEnabled(lang, configName)) {
this->CurrentLocalGenerator->AppendFeatureOptions(flags, lang, "IPO");
@@ -2407,6 +2419,18 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute("GCC_PREPROCESSOR_DEFINITIONS",
ppDefs.CreateList());
+ if (languages.count("Swift")) {
+ if (this->XcodeVersion < 80) {
+ std::string defineString;
+ std::set<std::string> defines(targetDefines.begin(),
+ targetDefines.end());
+ this->CurrentLocalGenerator->JoinDefines(defines, defineString, "Swift");
+ cflags["Swift"] += " " + defineString;
+ } else {
+ buildSettings->AddAttribute("SWIFT_ACTIVE_COMPILATION_CONDITIONS",
+ ppDefs.CreateList());
+ }
+ }
std::string extraLinkOptionsVar;
std::string extraLinkOptions;
@@ -2866,8 +2890,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
// Create the INSTALL_PATH attribute.
- std::string install_name_dir;
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
+ std::string install_name_dir;
// Get the install_name directory for the build tree.
install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
// Xcode doesn't create the correct install_name in some cases.
@@ -2889,9 +2913,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
extraLinkOptions += " -install_name ";
extraLinkOptions += XCodeEscapePath(install_name);
}
+ buildSettings->AddAttribute("INSTALL_PATH",
+ this->CreateString(install_name_dir));
}
- buildSettings->AddAttribute("INSTALL_PATH",
- this->CreateString(install_name_dir));
// Create the LD_RUNPATH_SEARCH_PATHS
cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName);
@@ -3613,9 +3637,10 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
linkDir = libItem->Value.Value;
}
if (cmHasSuffix(libItem->GetFeatureName(), "FRAMEWORK"_s)) {
- auto fwItems = this->SplitFrameworkPath(linkDir, true);
- if (fwItems && !fwItems->first.empty()) {
- linkDir = std::move(fwItems->first);
+ auto fwDescriptor = this->SplitFrameworkPath(
+ linkDir, cmGlobalGenerator::FrameworkFormat::Extended);
+ if (fwDescriptor && !fwDescriptor->Directory.empty()) {
+ linkDir = fwDescriptor->Directory;
if (std::find(frameworkSearchPaths.begin(), frameworkSearchPaths.end(),
linkDir) == frameworkSearchPaths.end()) {
frameworkSearchPaths.push_back(linkDir);
@@ -3748,14 +3773,20 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// add the library search paths
{
BuildObjectListOrString libSearchPaths(this, true);
+
std::string linkDirs;
for (auto const& libDir : cli->GetDirectories()) {
if (!libDir.empty() && libDir != "/usr/lib") {
- libSearchPaths.Add(this->XCodeEscapePath(
- libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ cmPolicies::PolicyStatus cmp0142 =
+ target->GetTarget()->GetPolicyStatusCMP0142();
+ if (cmp0142 == cmPolicies::OLD || cmp0142 == cmPolicies::WARN) {
+ libSearchPaths.Add(this->XCodeEscapePath(
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"));
+ }
libSearchPaths.Add(this->XCodeEscapePath(libDir));
}
}
+
// Add previously collected paths where to look for libraries
// that were added to "Link Binary With Libraries"
for (auto& libDir : linkSearchPaths) {
@@ -3805,13 +3836,14 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
bool isFramework =
cmHasSuffix(libName.GetFeatureName(), "FRAMEWORK"_s);
if (isFramework) {
- const auto fwItems =
- this->SplitFrameworkPath(cleanPath, isFramework);
- if (!fwItems->first.empty() &&
- emitted.insert(fwItems->first).second) {
+ const auto fwDescriptor = this->SplitFrameworkPath(
+ cleanPath, cmGlobalGenerator::FrameworkFormat::Extended);
+ if (!fwDescriptor->Directory.empty() &&
+ emitted.insert(fwDescriptor->Directory).second) {
// This is a search path we had not added before and it isn't
// an implicit search path, so we need it
- libPaths.Add("-F " + this->XCodeEscapePath(fwItems->first));
+ libPaths.Add("-F " +
+ this->XCodeEscapePath(fwDescriptor->Directory));
}
if (libName.GetFeatureName() == "__CMAKE_LINK_FRAMEWORK"_s) {
// use the full path
@@ -3819,10 +3851,10 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
libName.GetFormattedItem(this->XCodeEscapePath(cleanPath))
.Value);
} else {
- libPaths.Add(
- libName
- .GetFormattedItem(this->XCodeEscapePath(fwItems->second))
- .Value);
+ libPaths.Add(libName
+ .GetFormattedItem(this->XCodeEscapePath(
+ fwDescriptor->GetLinkName()))
+ .Value);
}
} else {
libPaths.Add(