Makefiles: Port CreateCDCommand to string-based API
This commit is contained in:
parent
ad70a236f4
commit
e0fd2d0446
|
@ -358,7 +358,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
|
||||||
this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
|
this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
|
||||||
}
|
}
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
|
|
||||||
// Write the rule to the makefile.
|
// Write the rule to the makefile.
|
||||||
std::vector<std::string> no_depends;
|
std::vector<std::string> no_depends;
|
||||||
|
@ -398,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(makefile2.c_str(), localName));
|
this->GetRecursiveMakeCall(makefile2.c_str(), localName));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
|
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
|
||||||
localName, depends, commands, true);
|
localName, depends, commands, true);
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
|
this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
|
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
|
||||||
localName, depends, commands, true);
|
localName, depends, commands, true);
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
|
this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream,
|
this->WriteMakeRule(ruleFileStream,
|
||||||
"Manual pre-install relink rule for target.",
|
"Manual pre-install relink rule for target.",
|
||||||
localName, depends, commands, true);
|
localName, depends, commands, true);
|
||||||
|
@ -793,7 +793,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
|
||||||
commands.push_back(runRule);
|
commands.push_back(runRule);
|
||||||
if (!this->IsRootMakefile()) {
|
if (!this->IsRootMakefile()) {
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
}
|
}
|
||||||
this->WriteMakeRule(
|
this->WriteMakeRule(
|
||||||
makefileStream, "Special rule to run CMake to check the build system "
|
makefileStream, "Special rule to run CMake to check the build system "
|
||||||
|
@ -1011,7 +1011,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the proper working directory for the commands.
|
// Setup the proper working directory for the commands.
|
||||||
this->CreateCDCommand(commands1, dir.c_str(), relative);
|
std::string relativeDir = this->GetRelativeRootPath(relative);
|
||||||
|
this->CreateCDCommand(commands1, dir.c_str(), relativeDir);
|
||||||
|
|
||||||
// push back the custom commands
|
// push back the custom commands
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
|
@ -1613,7 +1614,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
{
|
{
|
||||||
std::ostringstream progCmd;
|
std::ostringstream progCmd;
|
||||||
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
||||||
|
@ -1633,7 +1634,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
|
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
|
||||||
depends, commands, true);
|
depends, commands, true);
|
||||||
commands.clear();
|
commands.clear();
|
||||||
|
@ -1659,7 +1660,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||||
commands.push_back(
|
commands.push_back(
|
||||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
|
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
|
||||||
"preinstall", depends, commands, true);
|
"preinstall", depends, commands, true);
|
||||||
depends.clear();
|
depends.clear();
|
||||||
|
@ -1679,7 +1680,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||||
runRule += " 1";
|
runRule += " 1";
|
||||||
commands.push_back(runRule);
|
commands.push_back(runRule);
|
||||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
|
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
|
||||||
commands, true);
|
commands, true);
|
||||||
}
|
}
|
||||||
|
@ -2046,12 +2047,10 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
|
||||||
|
|
||||||
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
|
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
|
||||||
std::vector<std::string>& commands, const char* tgtDir,
|
std::vector<std::string>& commands, const char* tgtDir,
|
||||||
cmOutputConverter::RelativeRoot relRetDir)
|
std::string const& relDir)
|
||||||
{
|
{
|
||||||
const char* relDir = this->GetRelativeRootPath(relRetDir);
|
|
||||||
|
|
||||||
// do we need to cd?
|
// do we need to cd?
|
||||||
if (!strcmp(tgtDir, relDir)) {
|
if (tgtDir == relDir) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,7 @@ public:
|
||||||
|
|
||||||
// create a command that cds to the start dir then runs the commands
|
// create a command that cds to the start dir then runs the commands
|
||||||
void CreateCDCommand(std::vector<std::string>& commands,
|
void CreateCDCommand(std::vector<std::string>& commands,
|
||||||
const char* targetDir,
|
const char* targetDir, std::string const& relDir);
|
||||||
cmOutputConverter::RelativeRoot returnDir);
|
|
||||||
|
|
||||||
static std::string ConvertToQuotedOutputPath(const char* p,
|
static std::string ConvertToQuotedOutputPath(const char* p,
|
||||||
bool useWatcomQuote);
|
bool useWatcomQuote);
|
||||||
|
|
|
@ -389,7 +389,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
}
|
}
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
commands1.push_back(symlink);
|
commands1.push_back(symlink);
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
|
||||||
this->GeneratorTarget, "target");
|
this->GeneratorTarget, "target");
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
}
|
}
|
||||||
|
@ -672,7 +672,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
|
||||||
}
|
}
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
|
||||||
commands1.push_back(symlink);
|
commands1.push_back(symlink);
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
commands1, this->Makefile->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
commands1.clear();
|
commands1.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -649,7 +649,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
|
||||||
// Change the command working directory to the local build tree.
|
// Change the command working directory to the local build tree.
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
compileCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
compileCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), compileCommands.begin(),
|
commands.insert(commands.end(), compileCommands.begin(),
|
||||||
compileCommands.end());
|
compileCommands.end());
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
preprocessCommands,
|
preprocessCommands,
|
||||||
this->LocalGenerator->GetCurrentBinaryDirectory(),
|
this->LocalGenerator->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), preprocessCommands.begin(),
|
commands.insert(commands.end(), preprocessCommands.begin(),
|
||||||
preprocessCommands.end());
|
preprocessCommands.end());
|
||||||
} else {
|
} else {
|
||||||
|
@ -758,7 +758,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
|
||||||
|
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
assemblyCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
assemblyCommands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
commands.insert(commands.end(), assemblyCommands.begin(),
|
commands.insert(commands.end(), assemblyCommands.begin(),
|
||||||
assemblyCommands.end());
|
assemblyCommands.end());
|
||||||
} else {
|
} else {
|
||||||
|
@ -849,7 +849,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget);
|
||||||
this->LocalGenerator->CreateCDCommand(
|
this->LocalGenerator->CreateCDCommand(
|
||||||
commands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
commands, this->LocalGenerator->GetCurrentBinaryDirectory(),
|
||||||
cmOutputConverter::HOME_OUTPUT);
|
this->LocalGenerator->GetBinaryDirectory());
|
||||||
|
|
||||||
// Write the rule.
|
// Write the rule.
|
||||||
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
|
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, CM_NULLPTR,
|
||||||
|
|
Loading…
Reference in New Issue