diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 143773a85..f00d9c362 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/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 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;