mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 14:40:26 -06:00
Makefiles: Port CreateCDCommand to string-based API
This commit is contained in:
@@ -358,7 +358,7 @@ void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
|
||||
this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName));
|
||||
}
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
|
||||
// Write the rule to the makefile.
|
||||
std::vector<std::string> no_depends;
|
||||
@@ -398,7 +398,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(makefile2.c_str(), localName));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
|
||||
localName, depends, commands, true);
|
||||
|
||||
@@ -423,7 +423,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
|
||||
localName, depends, commands, true);
|
||||
|
||||
@@ -439,7 +439,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(makefile2.c_str(), makeTargetName));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream,
|
||||
"Manual pre-install relink rule for target.",
|
||||
localName, depends, commands, true);
|
||||
@@ -793,7 +793,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
|
||||
commands.push_back(runRule);
|
||||
if (!this->IsRootMakefile()) {
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
}
|
||||
this->WriteMakeRule(
|
||||
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.
|
||||
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
|
||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||
@@ -1613,7 +1614,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
{
|
||||
std::ostringstream progCmd;
|
||||
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
||||
@@ -1633,7 +1634,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
|
||||
depends, commands, true);
|
||||
commands.clear();
|
||||
@@ -1659,7 +1660,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||
commands.push_back(
|
||||
this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
|
||||
"preinstall", depends, commands, true);
|
||||
depends.clear();
|
||||
@@ -1679,7 +1680,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||
runRule += " 1";
|
||||
commands.push_back(runRule);
|
||||
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
|
||||
cmOutputConverter::START_OUTPUT);
|
||||
this->GetCurrentBinaryDirectory());
|
||||
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
|
||||
commands, true);
|
||||
}
|
||||
@@ -2046,12 +2047,10 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
|
||||
|
||||
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
|
||||
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?
|
||||
if (!strcmp(tgtDir, relDir)) {
|
||||
if (tgtDir == relDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user