mirror of
https://github.com/reactos/CMake.git
synced 2025-03-03 17:39:10 +00:00
ENH: Restored implementation of AddCustomCommandToCreateObject. Updated it to use newer custom command functionality.
This commit is contained in:
parent
ae2cbc346d
commit
bb014b0f4d
@ -472,6 +472,9 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
|||||||
flags += this->Makefile->GetSafeDefinition(varString.c_str());
|
flags += this->Makefile->GetSafeDefinition(varString.c_str());
|
||||||
flags += " ";
|
flags += " ";
|
||||||
flags += this->GetIncludeFlags(lang);
|
flags += this->GetIncludeFlags(lang);
|
||||||
|
|
||||||
|
// Construct the command lines.
|
||||||
|
cmCustomCommandLines commandLines;
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
cmSystemTools::ExpandList(rules, commands);
|
cmSystemTools::ExpandList(rules, commands);
|
||||||
cmLocalGenerator::RuleVariables vars;
|
cmLocalGenerator::RuleVariables vars;
|
||||||
@ -482,39 +485,45 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
|
|||||||
for(std::vector<std::string>::iterator i = commands.begin();
|
for(std::vector<std::string>::iterator i = commands.begin();
|
||||||
i != commands.end(); ++i)
|
i != commands.end(); ++i)
|
||||||
{
|
{
|
||||||
|
// Expand the full command line string.
|
||||||
this->ExpandRuleVariables(*i, vars);
|
this->ExpandRuleVariables(*i, vars);
|
||||||
|
|
||||||
|
// Parse the string to get the custom command line.
|
||||||
|
cmCustomCommandLine commandLine;
|
||||||
|
std::vector<cmStdString> cmd = cmSystemTools::ParseArguments(i->c_str());
|
||||||
|
for(std::vector<cmStdString>::iterator a = cmd.begin();
|
||||||
|
a != cmd.end(); ++a)
|
||||||
|
{
|
||||||
|
commandLine.push_back(*a);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store this command line.
|
||||||
|
commandLines.push_back(commandLine);
|
||||||
}
|
}
|
||||||
std::vector<std::string> sourceAndDeps;
|
|
||||||
sourceAndDeps.push_back(sourceFile);
|
// Check for extra object-file dependencies.
|
||||||
if(commands.size() > 1)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Currently custom rules can only have one command sorry ");
|
|
||||||
}
|
|
||||||
// Check for extra object-file dependencies.
|
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
const char* additionalDeps = source.GetProperty("OBJECT_DEPENDS");
|
const char* additionalDeps = source.GetProperty("OBJECT_DEPENDS");
|
||||||
if(additionalDeps)
|
if(additionalDeps)
|
||||||
{
|
{
|
||||||
cmSystemTools::ExpandListArgument(additionalDeps, depends);
|
cmSystemTools::ExpandListArgument(additionalDeps, depends);
|
||||||
for(std::vector<std::string>::iterator i = depends.begin();
|
}
|
||||||
i != depends.end(); ++i)
|
|
||||||
{
|
// Generate a meaningful comment for the command.
|
||||||
sourceAndDeps.push_back(this->Convert(i->c_str(),START_OUTPUT,SHELL));
|
std::string comment = "Building ";
|
||||||
}
|
comment += lang;
|
||||||
}
|
comment += " object ";
|
||||||
#if 0
|
comment += this->Convert(ofname, START_OUTPUT);
|
||||||
std::string command;
|
|
||||||
std::string args;
|
// Add the custom command to build the object file.
|
||||||
cmSystemTools::SplitProgramFromArgs(commands[0].c_str(), command, args);
|
this->Makefile->AddCustomCommandToOutput(
|
||||||
std::vector<std::string> argsv;
|
ofname,
|
||||||
argsv.push_back(args);
|
depends,
|
||||||
this->Makefile->AddCustomCommandToOutput(ofname,
|
source.GetFullPath().c_str(),
|
||||||
command.c_str(),
|
commandLines,
|
||||||
argsv,
|
comment.c_str(),
|
||||||
source.GetFullPath().c_str(),
|
this->Makefile->GetStartOutputDirectory()
|
||||||
sourceAndDeps,
|
);
|
||||||
"build from source");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
|
void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user