summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx89
1 files changed, 40 insertions, 49 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index e26182a..ddd8cc4 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -150,20 +150,6 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
}
}
-void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
- std::map<cmSourceFile const*, std::string>& mapping,
- cmGeneratorTarget const* gt)
-{
- // Determine if these object files should use a custom extension
- char const* custom_ext = gt->GetCustomObjectExtension();
- for (auto& si : mapping) {
- cmSourceFile const* sf = si.first;
- bool keptSourceExtension;
- si.second = this->GetObjectFileNameWithoutTarget(
- *sf, gt->ObjectDirectory, &keptSourceExtension, custom_ext);
- }
-}
-
void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
std::map<std::string, LocalObjectInfo>& localObjectFiles)
{
@@ -186,12 +172,12 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
bool hasSourceExtension = true;
std::string objectName =
this->GetObjectFileNameWithoutTarget(*sf, dir, &hasSourceExtension);
- if (cmSystemTools::FileIsFullPath(objectName.c_str())) {
+ if (cmSystemTools::FileIsFullPath(objectName)) {
objectName = cmSystemTools::GetFilenameName(objectName);
}
LocalObjectInfo& info = localObjectFiles[objectName];
info.HasSourceExtension = hasSourceExtension;
- info.push_back(LocalObjectEntry(gt, sf->GetLanguage()));
+ info.emplace_back(gt, sf->GetLanguage());
}
}
}
@@ -539,8 +525,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
// Construct the left hand side of the rule.
std::string tgt = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target)
- .c_str());
+ this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), target));
const char* space = "";
if (tgt.size() == 1) {
@@ -568,7 +553,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
for (std::string const& depend : depends) {
replace = depend;
replace = cmSystemTools::ConvertToOutputPath(
- this->MaybeConvertToRelativePath(binDir, replace).c_str());
+ this->MaybeConvertToRelativePath(binDir, replace));
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -588,7 +573,7 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd)
{
- if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
+ if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd) &&
cmd.find_first_of("( )") != std::string::npos) {
// On Watcom WMake use the windows short path for the command
// name. This is needed to avoid funny quoting problems on
@@ -750,11 +735,11 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsTop(
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
std::string hack = gg->GetEmptyRuleHackDepends();
if (!hack.empty()) {
- no_depends.push_back(hack);
+ no_depends.push_back(std::move(hack));
}
std::string hack_cmd = gg->GetEmptyRuleHackCommand();
if (!hack_cmd.empty()) {
- no_commands.push_back(hack_cmd);
+ no_commands.push_back(std::move(hack_cmd));
}
// Special symbolic target that never exists to force dependers to
@@ -788,7 +773,7 @@ void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
std::vector<std::string> no_depends;
std::vector<std::string> commands;
- commands.push_back(runRule);
+ commands.push_back(std::move(runRule));
if (!this->IsRootMakefile()) {
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
@@ -830,8 +815,8 @@ std::string cmLocalUnixMakefileGenerator3::GetRelativeTargetDirectory(
return dir;
}
-void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
- const std::string& newFlags)
+void cmLocalUnixMakefileGenerator3::AppendFlags(
+ std::string& flags, const std::string& newFlags) const
{
if (this->IsWatcomWMake() && !newFlags.empty()) {
std::string newf = newFlags;
@@ -845,7 +830,7 @@ void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
}
void cmLocalUnixMakefileGenerator3::AppendFlags(std::string& flags,
- const char* newFlags)
+ const char* newFlags) const
{
this->cmLocalGenerator::AppendFlags(flags, newFlags);
}
@@ -888,7 +873,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend(
// Lookup the real name of the dependency in case it is a CMake target.
std::string dep;
if (this->GetRealDependency(d, this->ConfigName, dep)) {
- depends.push_back(dep);
+ depends.push_back(std::move(dep));
}
}
}
@@ -1037,12 +1022,12 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
cmd = "echo >nul && " + cmd;
}
}
- commands1.push_back(cmd);
+ commands1.push_back(std::move(cmd));
}
}
// Setup the proper working directory for the commands.
- this->CreateCDCommand(commands1, dir.c_str(), relative);
+ this->CreateCDCommand(commands1, dir, relative);
// push back the custom commands
commands.insert(commands.end(), commands1.begin(), commands1.end());
@@ -1075,12 +1060,14 @@ void cmLocalUnixMakefileGenerator3::AppendCleanCommand(
}
fout << ")\n";
}
- std::string remove = "$(CMAKE_COMMAND) -P ";
- remove += this->ConvertToOutputFormat(
- this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(),
- cleanfile),
- cmOutputConverter::SHELL);
- commands.push_back(remove);
+ {
+ std::string remove = "$(CMAKE_COMMAND) -P ";
+ remove += this->ConvertToOutputFormat(
+ this->MaybeConvertToRelativePath(this->GetCurrentBinaryDirectory(),
+ cleanfile),
+ cmOutputConverter::SHELL);
+ commands.push_back(std::move(remove));
+ }
// For the main clean rule add per-language cleaning.
if (!filename) {
@@ -1158,10 +1145,10 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
}
cmd += this->EscapeForShell(line);
}
- commands.push_back(cmd);
+ commands.push_back(std::move(cmd));
}
- // Reset the line to emtpy.
+ // Reset the line to empty.
line.clear();
// Progress appears only on first line.
@@ -1444,6 +1431,8 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
}
#ifdef CMAKE_BUILD_WITH_CMAKE
else if (lang == "Fortran") {
+ ruleFileStream << "# Note that incremental build could trigger "
+ << "a call to cmake_copy_f90_mod on each re-build\n";
scanner = new cmDependsFortran(this);
} else if (lang == "Java") {
scanner = new cmDependsJava();
@@ -1486,8 +1475,8 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
// If the depender is missing then delete the dependee to make
// sure both will be regenerated.
- if (cmSystemTools::FileExists(dependee.c_str()) &&
- !cmSystemTools::FileExists(depender.c_str())) {
+ if (cmSystemTools::FileExists(dependee) &&
+ !cmSystemTools::FileExists(depender)) {
if (verbose) {
std::ostringstream msg;
msg << "Deleting primary custom command output \"" << dependee
@@ -1673,13 +1662,15 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
commands.clear();
std::string cmakefileName = cmake::GetCMakeFilesDirectoryPostSlash();
cmakefileName += "Makefile.cmake";
- std::string runRule =
- "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
- runRule += " --check-build-system ";
- runRule +=
- this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
- runRule += " 1";
- commands.push_back(runRule);
+ {
+ std::string runRule =
+ "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
+ runRule += " --check-build-system ";
+ runRule +=
+ this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL);
+ runRule += " 1";
+ commands.push_back(std::move(runRule));
+ }
this->CreateCDCommand(commands, this->GetBinaryDirectory(),
this->GetCurrentBinaryDirectory());
this->WriteMakeRule(ruleFileStream, "clear depends", "depend", depends,
@@ -1836,7 +1827,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
this->GetIncludeDirectories(includes, target, implicitLang.first, config);
std::string binaryDir = this->GetState()->GetBinaryDirectory();
if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
- const char* sourceDir = this->GetState()->GetSourceDirectory();
+ std::string const& sourceDir = this->GetState()->GetSourceDirectory();
cmEraseIf(includes, ::NotInProjectDir(sourceDir, binaryDir));
}
for (std::string const& include : includes) {
@@ -2037,7 +2028,7 @@ void cmLocalUnixMakefileGenerator3::AddImplicitDepends(
}
void cmLocalUnixMakefileGenerator3::CreateCDCommand(
- std::vector<std::string>& commands, const char* tgtDir,
+ std::vector<std::string>& commands, std::string const& tgtDir,
std::string const& relDir)
{
// do we need to cd?
@@ -2064,7 +2055,7 @@ void cmLocalUnixMakefileGenerator3::CreateCDCommand(
// Change back to the starting directory.
cmd = cd_cmd;
cmd += this->ConvertToOutputForExisting(relDir);
- commands.push_back(cmd);
+ commands.push_back(std::move(cmd));
} else {
// On UNIX we must construct a single shell command to change
// directory and build because make resets the directory between