소스 검색

cmAddCustom{Command,Target}Command: Skip conversions on genex paths

If an output or byproduct path starts in a generator expression, do not
convert it to a full path yet.  That will have to be done at generate
time after evaluating the generator expressions.

Also update the `add_custom_target` byproduct path conversion added by
commit 445ff5ccdf (Byproducts: collapse full paths of custom target
byproducts, 2019-09-11, v3.16.0-rc1~103^2~1) to match the behavior of
`add_custom_command` when a path starts in a generator expression.
Brad King 5 년 전
부모
커밋
b285748f79
2개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 1
      Source/cmAddCustomCommandCommand.cxx
  2. 6 2
      Source/cmAddCustomTargetCommand.cxx

+ 3 - 1
Source/cmAddCustomCommandCommand.cxx

@@ -10,6 +10,7 @@
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandLines.h"
 #include "cmCustomCommandTypes.h"
 #include "cmCustomCommandTypes.h"
 #include "cmExecutionStatus.h"
 #include "cmExecutionStatus.h"
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
 #include "cmGlobalGenerator.h"
 #include "cmMakefile.h"
 #include "cmMakefile.h"
 #include "cmMessageType.h"
 #include "cmMessageType.h"
@@ -188,7 +189,8 @@ bool cmAddCustomCommandCommand(std::vector<std::string> const& args,
         case doing_output:
         case doing_output:
         case doing_outputs:
         case doing_outputs:
         case doing_byproducts:
         case doing_byproducts:
-          if (!cmSystemTools::FileIsFullPath(copy)) {
+          if (!cmSystemTools::FileIsFullPath(copy) &&
+              cmGeneratorExpression::Find(copy) != 0) {
             // This is an output to be generated, so it should be
             // This is an output to be generated, so it should be
             // under the build tree.
             // under the build tree.
             filename = cmStrCat(mf.GetCurrentBinaryDirectory(), '/');
             filename = cmStrCat(mf.GetCurrentBinaryDirectory(), '/');

+ 6 - 2
Source/cmAddCustomTargetCommand.cxx

@@ -120,12 +120,16 @@ bool cmAddCustomTargetCommand(std::vector<std::string> const& args,
           break;
           break;
         case doing_byproducts: {
         case doing_byproducts: {
           std::string filename;
           std::string filename;
-          if (!cmSystemTools::FileIsFullPath(copy)) {
+          if (!cmSystemTools::FileIsFullPath(copy) &&
+              cmGeneratorExpression::Find(copy) != 0) {
             filename = cmStrCat(mf.GetCurrentBinaryDirectory(), '/');
             filename = cmStrCat(mf.GetCurrentBinaryDirectory(), '/');
           }
           }
           filename += copy;
           filename += copy;
           cmSystemTools::ConvertToUnixSlashes(filename);
           cmSystemTools::ConvertToUnixSlashes(filename);
-          byproducts.push_back(cmSystemTools::CollapseFullPath(filename));
+          if (cmSystemTools::FileIsFullPath(filename)) {
+            filename = cmSystemTools::CollapseFullPath(filename);
+          }
+          byproducts.push_back(filename);
         } break;
         } break;
         case doing_depends: {
         case doing_depends: {
           std::string dep = copy;
           std::string dep = copy;