瀏覽代碼

BUG: Move hack from old cmMakefile::AddUtilityTarget to this command directly. There really needs to be a better way to represent external project targets.

Brad King 19 年之前
父節點
當前提交
1d2fd77ca5
共有 1 個文件被更改,包括 23 次插入7 次删除
  1. 23 7
      Source/cmIncludeExternalMSProjectCommand.cxx

+ 23 - 7
Source/cmIncludeExternalMSProjectCommand.cxx

@@ -40,18 +40,34 @@ bool cmIncludeExternalMSProjectCommand
         depends.push_back(args[i]); 
         }
       }
-    
+
+    // Hack together a utility target storing enough information
+    // to reproduce the target inclusion.
     std::string utility_name("INCLUDE_EXTERNAL_MSPROJECT");
     utility_name += "_";
     utility_name += args[0];
     std::string path = args[1];
     cmSystemTools::ConvertToUnixSlashes(path);
-    const char* no_working_directory = 0;
-    this->Makefile->AddUtilityCommand(utility_name.c_str(), true,
-                                  depends,
-                                  no_working_directory,
-                                  args[0].c_str(), path.c_str());
-    
+
+    // Create a target instance for this utility.
+    cmTarget target;
+    target.SetType(cmTarget::UTILITY, utility_name.c_str());
+    target.SetInAll(true);
+    target.SetMakefile(this->Makefile);
+    std::vector<std::string> no_outputs;
+    cmCustomCommandLines commandLines;
+    cmCustomCommandLine commandLine;
+    commandLine.push_back(args[0]);
+    commandLine.push_back(path);
+    commandLines.push_back(commandLine);
+    cmCustomCommand cc(no_outputs, depends, commandLines, 0, 0);
+    target.GetPostBuildCommands().push_back(cc);
+
+    // Add the target to the set of targets.
+    cmTargets::iterator it =
+      this->Makefile->GetTargets()
+      .insert(cmTargets::value_type(utility_name.c_str(),target)).first;
+    this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->AddTarget(*it);
     }
 #endif
   return true;