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

This commit is contained in:
Brad King 2006-09-28 17:35:24 -04:00
parent bd6aaef001
commit 1d2fd77ca5
1 changed files with 23 additions and 7 deletions

View File

@ -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;