diff options
author | Brad King <brad.king@kitware.com> | 2020-09-03 13:17:58 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-03 13:18:05 (GMT) |
commit | ca5babfd7a1da8e32f927ad086fdd91c2b09853b (patch) | |
tree | 23619c551a1b4c24ff228f98a3503b64a189fb32 /Source/cmGlobalXCodeGenerator.cxx | |
parent | 85e52ea704e13bbf932cd65c225b82f9b945e071 (diff) | |
parent | 11425041f04fd0945480b8f9e9933d1549b93981 (diff) | |
download | CMake-ca5babfd7a1da8e32f927ad086fdd91c2b09853b.zip CMake-ca5babfd7a1da8e32f927ad086fdd91c2b09853b.tar.gz CMake-ca5babfd7a1da8e32f927ad086fdd91c2b09853b.tar.bz2 |
Merge topic 'getdef'
11425041f0 cmMakefile::GetDefinition: return cmProp
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5179
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 450b2b1..dbc95e6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3567,12 +3567,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->CreateString(defaultConfigName)); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - const char* sysroot = - this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); - const char* deploymentTarget = + cmProp sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); + cmProp deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); if (sysroot) { - buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); + buildSettings->AddAttribute("SDKROOT", this->CreateString(*sysroot)); } // recompute this as it may have been changed since enable language this->ComputeArchitectures(this->CurrentMakefile); @@ -3583,7 +3582,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( // When targeting macOS, use only the host architecture. if (this->SystemName == "Darwin"_s && (!cmNonempty(sysroot) || - cmSystemTools::LowerCase(sysroot).find("macos") != + cmSystemTools::LowerCase(*sysroot).find("macos") != std::string::npos)) { buildSettings->AddAttribute("ARCHS", this->CreateString("$(NATIVE_ARCH_ACTUAL)")); @@ -3594,7 +3593,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( } if (cmNonempty(deploymentTarget)) { buildSettings->AddAttribute(GetDeploymentPlatform(root->GetMakefile()), - this->CreateString(deploymentTarget)); + this->CreateString(*deploymentTarget)); } if (!this->GeneratorToolset.empty()) { buildSettings->AddAttribute("GCC_VERSION", @@ -3602,9 +3601,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( } if (this->GetLanguageEnabled("Swift")) { std::string swiftVersion; - if (const char* vers = this->CurrentMakefile->GetDefinition( + if (cmProp vers = this->CurrentMakefile->GetDefinition( "CMAKE_Swift_LANGUAGE_VERSION")) { - swiftVersion = vers; + swiftVersion = *vers; } else if (this->XcodeVersion >= 102) { swiftVersion = "4.0"; } else if (this->XcodeVersion >= 83) { @@ -3687,7 +3686,7 @@ std::string cmGlobalXCodeGenerator::GetObjectsDirectory( void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) { this->Architectures.clear(); - const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); + cmProp sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); if (sysroot) { mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures); } @@ -3696,8 +3695,8 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) // With no ARCHS we use ONLY_ACTIVE_ARCH and possibly a // platform-specific default ARCHS placeholder value. // Look up the arch that Xcode chooses in this case. - if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) { - this->ObjectDirArchDefault = arch; + if (cmProp arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) { + this->ObjectDirArchDefault = *arch; // We expect only one arch but choose the first just in case. std::string::size_type pos = this->ObjectDirArchDefault.find(';'); if (pos != std::string::npos) { @@ -4063,9 +4062,9 @@ std::string cmGlobalXCodeGenerator::LookupFlags( { if (!varNameLang.empty()) { std::string varName = cmStrCat(varNamePrefix, varNameLang, varNameSuffix); - if (const char* varValue = this->CurrentMakefile->GetDefinition(varName)) { - if (*varValue) { - return varValue; + if (cmProp varValue = this->CurrentMakefile->GetDefinition(varName)) { + if (!varValue->empty()) { + return *varValue; } } } |