Преглед изворни кода

cmVisualStudio10TargetGenerator: Refactor per-source PCH logic

De-duplicate the link language lookup.
Brad King пре 4 година
родитељ
комит
d9fd32b3b3
1 измењених фајлова са 6 додато и 6 уклоњено
  1. 6 6
      Source/cmVisualStudio10TargetGenerator.cxx

+ 6 - 6
Source/cmVisualStudio10TargetGenerator.cxx

@@ -2413,16 +2413,16 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
     // 1. We have SKIP_PRECOMPILE_HEADERS == true
     // 2. We are creating the pre-compiled header
     // 3. We are a different language than the linker language AND pch is
-    // enabled
-    const std::string pchSource =
+    //    enabled.
+    std::string const& linkLanguage =
+      this->GeneratorTarget->GetLinkerLanguage(config);
+    std::string const& pchSource =
       this->GeneratorTarget->GetPchSource(config, lang);
     const bool skipPCH =
       pchSource.empty() || sf.GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS");
     const bool makePCH = (sf.GetFullPath() == pchSource);
-    const bool useSharedPCH =
-      !skipPCH && (lang == this->GeneratorTarget->GetLinkerLanguage(config));
-    const bool useDifferentLangPCH =
-      !skipPCH && (lang != this->GeneratorTarget->GetLinkerLanguage(config));
+    const bool useSharedPCH = !skipPCH && (lang == linkLanguage);
+    const bool useDifferentLangPCH = !skipPCH && (lang != linkLanguage);
     const bool needsPCHFlags =
       (makePCH || useSharedPCH || useDifferentLangPCH);