diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 6d77f85952..4a8716f8ed 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 541c2a6593..0b376c12cd 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 7c1ff7231b..256ca3bdbd 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 6fca5f4a79..139635797f 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 6fc45972fc..01e4241360 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 a7e5eca948..e6f8cddf2a 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 ce5e501c77..87193646e9 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(); }