From 43e973eba2681788c7acf7a4fcdf261bcf6a622a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 14 Mar 2023 17:11:27 -0400 Subject: cmGeneratorTarget: Pass language to GetAppleArchs when possible --- Source/cmFileAPICodemodel.cxx | 2 +- Source/cmGeneratorTarget.cxx | 3 ++- Source/cmGeneratorTarget.h | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 3 ++- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmMakefileTargetGenerator.cxx | 4 ++-- Source/cmNinjaTargetGenerator.cxx | 4 ++-- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 6d77f85..4a8716f 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -1356,7 +1356,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) // Add precompile headers compile options. std::vector architectures = - this->GT->GetAppleArchs(this->Config); + this->GT->GetAppleArchs(this->Config, fd.Language); if (architectures.empty()) { architectures.emplace_back(); } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 541c2a6..0b376c1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3449,8 +3449,9 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory( } std::vector cmGeneratorTarget::GetAppleArchs( - std::string const& config) const + std::string const& config, cm::optional lang) const { + static_cast(lang); std::vector archVec; if (!this->IsApple()) { return archVec; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 7c1ff72..256ca3b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -484,7 +484,8 @@ public: holding object files for the given configuration. */ std::string GetObjectDirectory(std::string const& config) const; - std::vector GetAppleArchs(std::string const& config) const; + std::vector GetAppleArchs(std::string const& config, + cm::optional lang) const; void AddExplicitLanguageFlags(std::string& flags, cmSourceFile const& sf) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6fca5f4..1396357 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2513,7 +2513,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } // Set target-specific architectures. - std::vector archs = gtgt->GetAppleArchs(configName); + std::vector archs = + gtgt->GetAppleArchs(configName, cm::nullopt); if (!archs.empty()) { // Enable ARCHS attribute. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6fc4597..01e4241 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1873,7 +1873,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, { // Only add Apple specific flags on Apple platforms if (target->IsApple() && this->EmitUniversalBinaryFlags) { - std::vector archs = target->GetAppleArchs(config); + std::vector archs = target->GetAppleArchs(config, lang); if (!archs.empty() && (lang == "C" || lang == "CXX" || lang == "OBJC" || lang == "OBJCXX" || lang == "ASM")) { @@ -2593,7 +2593,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) std::vector architectures; if (!this->GetGlobalGenerator()->IsXcode()) { - architectures = target->GetAppleArchs(config); + architectures = target->GetAppleArchs(config, lang); } if (architectures.empty()) { architectures.emplace_back(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index a7e5eca..e6f8cdd 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -542,7 +542,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() *this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n"; std::vector architectures = - this->GeneratorTarget->GetAppleArchs(this->GetConfigName()); + this->GeneratorTarget->GetAppleArchs(this->GetConfigName(), language); architectures.emplace_back(); for (const std::string& arch : architectures) { @@ -672,7 +672,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Add precompile headers dependencies std::vector architectures = - this->GeneratorTarget->GetAppleArchs(config); + this->GeneratorTarget->GetAppleArchs(config, lang); if (architectures.empty()) { architectures.emplace_back(); } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index ce5e501..8719364 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -171,7 +171,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject( { std::unordered_map pchSources; std::vector architectures = - this->GeneratorTarget->GetAppleArchs(config); + this->GeneratorTarget->GetAppleArchs(config, language); if (architectures.empty()) { architectures.emplace_back(); } @@ -1391,7 +1391,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( std::vector depList; std::vector architectures = - this->GeneratorTarget->GetAppleArchs(config); + this->GeneratorTarget->GetAppleArchs(config, language); if (architectures.empty()) { architectures.emplace_back(); } -- cgit v0.12