diff options
author | Brad King <brad.king@kitware.com> | 2006-06-26 19:27:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-06-26 19:27:51 (GMT) |
commit | 35c3a91bc1be2a62109ee206e45fb3cc7eacd5e0 (patch) | |
tree | 02f8c3f4b2ff922fe209ffe663987a1fee144e04 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | e050211a6d20631f0be63ac5be1a083ac3844d40 (diff) | |
download | CMake-35c3a91bc1be2a62109ee206e45fb3cc7eacd5e0.zip CMake-35c3a91bc1be2a62109ee206e45fb3cc7eacd5e0.tar.gz CMake-35c3a91bc1be2a62109ee206e45fb3cc7eacd5e0.tar.bz2 |
BUG: When using a working directory for the custom command do not convert paths to be relative to the build directory.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9ca09df..575cd55 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -788,9 +788,16 @@ cmLocalUnixMakefileGenerator3 ::AppendCustomCommand(std::vector<std::string>& commands, 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. + std::vector<std::string> commands1; for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin(); cl != cc.GetCommandLines().end(); ++cl) { @@ -800,7 +807,12 @@ cmLocalUnixMakefileGenerator3 if (cmd.size()) { cmSystemTools::ReplaceString(cmd, "/./", "/"); - cmd = this->Convert(cmd.c_str(),START_OUTPUT); + // 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); + } if(cmd.find("/") == cmd.npos && commandLine[0].find("/") != cmd.npos) { @@ -826,16 +838,11 @@ cmLocalUnixMakefileGenerator3 } } - // push back the custom commands - const char* dir = this->Makefile->GetStartOutputDirectory(); - // if the command specified a working directory use it. - if(cc.GetWorkingDirectory()) - { - dir = cc.GetWorkingDirectory(); - } + // Setup the proper working directory for the commands. this->CreateCDCommand(commands1, dir, this->Makefile->GetHomeOutputDirectory()); + // push back the custom commands commands.insert(commands.end(), commands1.begin(), commands1.end()); } |