فهرست منبع

Merge topic 'vs-no-dupe-object-filename' into release-4.2

e4f6701ad4 cmVisualStudio10TargetGenerator: use language extension for objects
3b9cd510d7 cmVisualStudio10TargetGenerator: only write a single object filename

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11654
Brad King 3 هفته پیش
والد
کامیت
e2773ff3f1
1فایلهای تغییر یافته به همراه11 افزوده شده و 11 حذف شده
  1. 11 11
      Source/cmVisualStudio10TargetGenerator.cxx

+ 11 - 11
Source/cmVisualStudio10TargetGenerator.cxx

@@ -2741,13 +2741,22 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
         customObjectName =
           this->LocalGenerator->GetCustomObjectFileName(*si.Source);
       }
+      if (customObjectName.empty()) {
+        if (this->GeneratorTarget->HasExplicitObjectName(si.Source)) {
+          customObjectName = this->GeneratorTarget->GetObjectName(si.Source);
+        }
+      } else {
+        customObjectName =
+          cmStrCat(std::move(customObjectName),
+                   this->GlobalGenerator->GetLanguageOutputExtension(
+                     si.Source->GetLanguage()));
+      }
       if (!customObjectName.empty()) {
         std::string outputName = "ObjectFileName";
         if (si.Source->GetLanguage() == "CUDA"_s) {
           outputName = "CompileOut";
         }
-        e2.Element(outputName,
-                   cmStrCat("$(IntDir)", customObjectName, ".obj"));
+        e2.Element(outputName, cmStrCat("$(IntDir)", customObjectName));
       }
 
       this->FinishWritingSource(e2, toolSettings);
@@ -2849,15 +2858,6 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
   }
 
   bool noWinRT = this->TargetCompileAsWinRT && lang == "C"_s;
-  // for the first time we need a new line if there is something
-  // produced here.
-  if (!objectName.empty()) {
-    if (lang == "CUDA"_s) {
-      e2.Element("CompileOut", cmStrCat("$(IntDir)/", objectName));
-    } else {
-      e2.Element("ObjectFileName", cmStrCat("$(IntDir)/", objectName));
-    }
-  }
 
   if (lang == "ASM_NASM"_s) {
     if (cmValue objectDeps = sf.GetProperty("OBJECT_DEPENDS")) {