BUG: When using a working directory for the custom command do not convert paths to be relative to the build directory.
This commit is contained in:
parent
e050211a6d
commit
35c3a91bc1
|
@ -788,9 +788,16 @@ cmLocalUnixMakefileGenerator3
|
||||||
::AppendCustomCommand(std::vector<std::string>& commands,
|
::AppendCustomCommand(std::vector<std::string>& commands,
|
||||||
const cmCustomCommand& cc)
|
const cmCustomCommand& cc)
|
||||||
{
|
{
|
||||||
std::vector<std::string> commands1;
|
// if the command specified a working directory use it.
|
||||||
|
const char* dir = this->Makefile->GetStartOutputDirectory();
|
||||||
|
const char* workingDir = cc.GetWorkingDirectory();
|
||||||
|
if(workingDir)
|
||||||
|
{
|
||||||
|
dir = workingDir;
|
||||||
|
}
|
||||||
|
|
||||||
// Add each command line to the set of commands.
|
// Add each command line to the set of commands.
|
||||||
|
std::vector<std::string> commands1;
|
||||||
for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin();
|
for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin();
|
||||||
cl != cc.GetCommandLines().end(); ++cl)
|
cl != cc.GetCommandLines().end(); ++cl)
|
||||||
{
|
{
|
||||||
|
@ -800,7 +807,12 @@ cmLocalUnixMakefileGenerator3
|
||||||
if (cmd.size())
|
if (cmd.size())
|
||||||
{
|
{
|
||||||
cmSystemTools::ReplaceString(cmd, "/./", "/");
|
cmSystemTools::ReplaceString(cmd, "/./", "/");
|
||||||
|
// Convert the command to a relative path only if the current
|
||||||
|
// working directory will be the start-output directory.
|
||||||
|
if(!workingDir)
|
||||||
|
{
|
||||||
cmd = this->Convert(cmd.c_str(),START_OUTPUT);
|
cmd = this->Convert(cmd.c_str(),START_OUTPUT);
|
||||||
|
}
|
||||||
if(cmd.find("/") == cmd.npos &&
|
if(cmd.find("/") == cmd.npos &&
|
||||||
commandLine[0].find("/") != cmd.npos)
|
commandLine[0].find("/") != cmd.npos)
|
||||||
{
|
{
|
||||||
|
@ -826,16 +838,11 @@ cmLocalUnixMakefileGenerator3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// push back the custom commands
|
// Setup the proper working directory for the commands.
|
||||||
const char* dir = this->Makefile->GetStartOutputDirectory();
|
|
||||||
// if the command specified a working directory use it.
|
|
||||||
if(cc.GetWorkingDirectory())
|
|
||||||
{
|
|
||||||
dir = cc.GetWorkingDirectory();
|
|
||||||
}
|
|
||||||
this->CreateCDCommand(commands1, dir,
|
this->CreateCDCommand(commands1, dir,
|
||||||
this->Makefile->GetHomeOutputDirectory());
|
this->Makefile->GetHomeOutputDirectory());
|
||||||
|
|
||||||
|
// push back the custom commands
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue