소스 검색

Merge topic 'vs-16.4-custom-commands'

0578239d3a VS: Tell VS 16.4 not to verify SYMBOLIC custom command outputs

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3860
Brad King 6 년 전
부모
커밋
76ae4c5839
2개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. 16 2
      Source/cmVisualStudio10TargetGenerator.cxx
  2. 1 1
      Source/cmVisualStudio10TargetGenerator.h

+ 16 - 2
Source/cmVisualStudio10TargetGenerator.cxx

@@ -1466,6 +1466,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
     }
     // output files for custom command
     std::stringstream outputs;
+    bool symbolic = false;
     {
       const char* sep = "";
       for (std::string const& o : ccg.GetOutputs()) {
@@ -1473,6 +1474,12 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
         ConvertToWindowsSlash(out);
         outputs << sep << out;
         sep = ";";
+        if (!symbolic) {
+          if (cmSourceFile* sf = this->Makefile->GetSource(
+                o, cmSourceFileLocationKind::Known)) {
+            symbolic = sf->GetPropertyAsBool("SYMBOLIC");
+          }
+        }
       }
     }
     if (this->ProjectType == csproj) {
@@ -1482,7 +1489,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
                                   outputs.str(), comment);
     } else {
       this->WriteCustomRuleCpp(*spe2, c, script, additional_inputs.str(),
-                               outputs.str(), comment);
+                               outputs.str(), comment, symbolic);
     }
   }
 }
@@ -1490,7 +1497,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
 void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp(
   Elem& e2, std::string const& config, std::string const& script,
   std::string const& additional_inputs, std::string const& outputs,
-  std::string const& comment)
+  std::string const& comment, bool symbolic)
 {
   const std::string cond = this->CalcCondition(config);
   e2.WritePlatformConfigTag("Message", cond, comment);
@@ -1502,6 +1509,13 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp(
     // VS >= 11 let us turn off linking of custom command outputs.
     e2.WritePlatformConfigTag("LinkObjects", cond, "false");
   }
+  if (symbolic &&
+      this->LocalGenerator->GetVersion() >=
+        cmGlobalVisualStudioGenerator::VS16) {
+    // VS >= 16.4 warn if outputs are not created, but one of our
+    // outputs is marked SYMBOLIC and not expected to be created.
+    e2.WritePlatformConfigTag("VerifyInputsAndOutputsExist", cond, "false");
+  }
 }
 
 void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp(

+ 1 - 1
Source/cmVisualStudio10TargetGenerator.h

@@ -142,7 +142,7 @@ private:
                           std::string const& script,
                           std::string const& additional_inputs,
                           std::string const& outputs,
-                          std::string const& comment);
+                          std::string const& comment, bool symbolic);
   void WriteCustomRuleCSharp(Elem& e0, std::string const& config,
                              std::string const& commandName,
                              std::string const& script,