소스 검색

cmGeneratorTarget: Pass language to GetAppleArchs when possible

Brad King 2 년 전
부모
커밋
43e973eba2

+ 1 - 1
Source/cmFileAPICodemodel.cxx

@@ -1356,7 +1356,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
 
   // Add precompile headers compile options.
   std::vector<std::string> architectures =
-    this->GT->GetAppleArchs(this->Config);
+    this->GT->GetAppleArchs(this->Config, fd.Language);
   if (architectures.empty()) {
     architectures.emplace_back();
   }

+ 2 - 1
Source/cmGeneratorTarget.cxx

@@ -3449,8 +3449,9 @@ std::string cmGeneratorTarget::GetCompilePDBDirectory(
 }
 
 std::vector<std::string> cmGeneratorTarget::GetAppleArchs(
-  std::string const& config) const
+  std::string const& config, cm::optional<std::string> lang) const
 {
+  static_cast<void>(lang);
   std::vector<std::string> archVec;
   if (!this->IsApple()) {
     return archVec;

+ 2 - 1
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<std::string> GetAppleArchs(std::string const& config) const;
+  std::vector<std::string> GetAppleArchs(std::string const& config,
+                                         cm::optional<std::string> lang) const;
 
   void AddExplicitLanguageFlags(std::string& flags,
                                 cmSourceFile const& sf) const;

+ 2 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -2513,7 +2513,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
   }
 
   // Set target-specific architectures.
-  std::vector<std::string> archs = gtgt->GetAppleArchs(configName);
+  std::vector<std::string> archs =
+    gtgt->GetAppleArchs(configName, cm::nullopt);
 
   if (!archs.empty()) {
     // Enable ARCHS attribute.

+ 2 - 2
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<std::string> archs = target->GetAppleArchs(config);
+    std::vector<std::string> 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<std::string> architectures;
       if (!this->GetGlobalGenerator()->IsXcode()) {
-        architectures = target->GetAppleArchs(config);
+        architectures = target->GetAppleArchs(config, lang);
       }
       if (architectures.empty()) {
         architectures.emplace_back();

+ 2 - 2
Source/cmMakefileTargetGenerator.cxx

@@ -542,7 +542,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
     *this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n";
 
     std::vector<std::string> 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<std::string> architectures =
-    this->GeneratorTarget->GetAppleArchs(config);
+    this->GeneratorTarget->GetAppleArchs(config, lang);
   if (architectures.empty()) {
     architectures.emplace_back();
   }

+ 2 - 2
Source/cmNinjaTargetGenerator.cxx

@@ -171,7 +171,7 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
 {
   std::unordered_map<std::string, std::string> pchSources;
   std::vector<std::string> 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<std::string> depList;
 
   std::vector<std::string> architectures =
-    this->GeneratorTarget->GetAppleArchs(config);
+    this->GeneratorTarget->GetAppleArchs(config, language);
   if (architectures.empty()) {
     architectures.emplace_back();
   }