summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx284
1 files changed, 174 insertions, 110 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 93722d1..2d36089 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -80,7 +80,6 @@ static std::string cmSplitExtension(std::string const& in, std::string& base)
//----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
{
- this->SilentNoColon = false;
this->WindowsShell = false;
this->IncludeDirective = "include";
this->MakefileVariableSize = 0;
@@ -173,26 +172,71 @@ void cmLocalUnixMakefileGenerator3::Generate()
}
//----------------------------------------------------------------------------
-void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
- cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
- bool hasSourceExtension)
+void cmLocalUnixMakefileGenerator3::ComputeObjectFilenames(
+ std::map<cmSourceFile const*, std::string>& mapping,
+ cmGeneratorTarget const* gt)
{
- if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
+ for(std::map<cmSourceFile const*, std::string>::iterator
+ si = mapping.begin(); si != mapping.end(); ++si)
{
- objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
+ cmSourceFile const* sf = si->first;
+ si->second = this->GetObjectFileNameWithoutTarget(*sf,
+ gt->ObjectDirectory);
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmLocalUnixMakefileGenerator3::
+GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
+{
+ std::set<std::string> emitted;
+ cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
+ for(cmGeneratorTargetsType::iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ cmGeneratorTarget* gt = ti->second;
+ if (gt->GetType() == cmTarget::INTERFACE_LIBRARY)
+ {
+ continue;
+ }
+ std::vector<cmSourceFile const*> objectSources;
+ gt->GetObjectSources(objectSources);
+ // Compute full path to object file directory for this target.
+ std::string dir_max;
+ dir_max += gt->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ dir_max += this->GetTargetDirectory(*gt->Target);
+ dir_max += "/";
+ // Compute the name of each object file.
+ for(std::vector<cmSourceFile const*>::iterator
+ si = objectSources.begin();
+ si != objectSources.end(); ++si)
+ {
+ cmSourceFile const* sf = *si;
+ bool hasSourceExtension = true;
+ std::string objectName = this->GetObjectFileNameWithoutTarget(*sf,
+ dir_max,
+ &hasSourceExtension);
+ if(cmSystemTools::FileIsFullPath(objectName.c_str()))
+ {
+ objectName = cmSystemTools::GetFilenameName(objectName);
+ }
+ LocalObjectInfo& info = localObjectFiles[objectName];
+ info.HasSourceExtension = hasSourceExtension;
+ info.push_back(LocalObjectEntry(gt->Target, sf->GetLanguage()));
+ }
}
- LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir];
- info.HasSourceExtension = hasSourceExtension;
- info.push_back(LocalObjectEntry(target, sf->GetLanguage()));
}
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
(std::vector<std::string>& targets)
{
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
- this->LocalObjectFiles.begin();
- lo != this->LocalObjectFiles.end(); ++lo)
+ std::map<std::string, LocalObjectInfo> localObjectFiles;
+ this->GetLocalObjectFiles(localObjectFiles);
+ for (std::map<std::string, LocalObjectInfo>::iterator lo =
+ localObjectFiles.begin();
+ lo != localObjectFiles.end(); ++lo)
{
targets.push_back(lo->first);
@@ -235,7 +279,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// only write local targets unless at the top Keep track of targets already
// listed.
- std::set<cmStdString> emittedTargets;
+ std::set<std::string> emittedTargets;
if (this->Parent)
{
// write our targets, and while doing it collect up the object
@@ -254,11 +298,14 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
bool do_assembly_rules =
this->GetCreateAssemblySourceRules();
+ std::map<std::string, LocalObjectInfo> localObjectFiles;
+ this->GetLocalObjectFiles(localObjectFiles);
+
// now write out the object rules
// for each object file name
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
- this->LocalObjectFiles.begin();
- lo != this->LocalObjectFiles.end(); ++lo)
+ for (std::map<std::string, LocalObjectInfo>::iterator lo =
+ localObjectFiles.begin();
+ lo != localObjectFiles.end(); ++lo)
{
// Add a convenience rule for building the object file.
this->WriteObjectConvenienceRule(ruleFileStream,
@@ -339,7 +386,7 @@ cmLocalUnixMakefileGenerator3
depends.push_back(output);
std::vector<std::string> no_commands;
this->WriteMakeRule(ruleFileStream, 0,
- outNoExt.c_str(), depends, no_commands, true, true);
+ outNoExt, depends, no_commands, true, true);
inHelp = false;
}
@@ -355,7 +402,7 @@ cmLocalUnixMakefileGenerator3
targetName += "/";
targetName += output;
commands.push_back(
- this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str())
+ this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName)
);
}
this->CreateCDCommand(commands,
@@ -371,7 +418,7 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3
::WriteLocalMakefileTargets(std::ostream& ruleFileStream,
- std::set<cmStdString> &emitted)
+ std::set<std::string> &emitted)
{
std::vector<std::string> depends;
std::vector<std::string> commands;
@@ -407,12 +454,12 @@ void cmLocalUnixMakefileGenerator3
std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash();
makefile2 += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall
- (makefile2.c_str(),localName.c_str()));
+ (makefile2.c_str(),localName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
// Add a target with the canonical name (no prefix, suffix or path).
if(localName != t->second->GetName())
@@ -436,17 +483,17 @@ void cmLocalUnixMakefileGenerator3
depends.clear();
commands.clear();
commands.push_back(this->GetRecursiveMakeCall
- (makefileName.c_str(), makeTargetName.c_str()));
+ (makefileName.c_str(), makeTargetName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
// Add a local name for the rule to relink the target before
// installation.
if(t->second->Target
- ->NeedRelinkBeforeInstall(this->ConfigurationName.c_str()))
+ ->NeedRelinkBeforeInstall(this->ConfigurationName))
{
makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target);
makeTargetName += "/preinstall";
@@ -455,13 +502,13 @@ void cmLocalUnixMakefileGenerator3
depends.clear();
commands.clear();
commands.push_back(this->GetRecursiveMakeCall
- (makefile2.c_str(), makeTargetName.c_str()));
+ (makefile2.c_str(), makeTargetName));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.",
- localName.c_str(), depends, commands, true);
+ localName, depends, commands, true);
}
}
}
@@ -550,14 +597,14 @@ void
cmLocalUnixMakefileGenerator3
::WriteMakeRule(std::ostream& os,
const char* comment,
- const char* target,
+ const std::string& target,
const std::vector<std::string>& depends,
const std::vector<std::string>& commands,
bool symbolic,
bool in_help)
{
// Make sure there is a target.
- if(!target || !*target)
+ if(target.empty())
{
cmSystemTools::Error("No target for WriteMakeRule! called with comment: ",
comment);
@@ -582,7 +629,7 @@ cmLocalUnixMakefileGenerator3
// Construct the left hand side of the rule.
replace = target;
- std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
+ std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
const char* space = "";
if(tgt.size() == 1)
{
@@ -615,7 +662,7 @@ cmLocalUnixMakefileGenerator3
dep != depends.end(); ++dep)
{
replace = *dep;
- replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE);
+ replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
@@ -625,7 +672,7 @@ cmLocalUnixMakefileGenerator3
i != commands.end(); ++i)
{
replace = *i;
- os << "\t" << replace.c_str() << "\n";
+ os << "\t" << replace << "\n";
}
if(symbolic && !this->WatcomWMake)
{
@@ -654,10 +701,10 @@ cmLocalUnixMakefileGenerator3
std::string scmd;
if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
{
- return this->Convert(scmd.c_str(), NONE, SHELL);
+ return this->Convert(scmd, NONE, SHELL);
}
}
- return this->Convert(cmd.c_str(), root, SHELL);
+ return this->Convert(cmd, root, SHELL);
}
//----------------------------------------------------------------------------
@@ -758,15 +805,17 @@ cmLocalUnixMakefileGenerator3
depends.push_back(".hpux_make_needs_suffix_list");
this->WriteMakeRule(makefileStream, 0,
".SUFFIXES", depends, no_commands, false);
-
- cmGlobalUnixMakefileGenerator3* gg =
- static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
- // Write special target to silence make output. This must be after
- // the default target in case VERBOSE is set (which changes the
- // name). The setting of CMAKE_VERBOSE_MAKEFILE to ON will cause a
- // "VERBOSE=1" to be added as a make variable which will change the
- // name of this special target. This gives a make-time choice to
- // the user.
+ if(this->WatcomWMake)
+ {
+ // Switch on WMake feature, if an error or interrupt occurs during
+ // makefile processing, the current target being made may be deleted
+ // without prompting (the same as command line -e option).
+ makefileStream <<
+ "\n"
+ ".ERASE\n"
+ "\n"
+ ;
+ }
if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
{
makefileStream
@@ -774,12 +823,22 @@ cmLocalUnixMakefileGenerator3
<< "VERBOSE = 1\n"
<< "\n";
}
- if(this->SilentNoColon)
+ if(this->WatcomWMake)
{
- makefileStream << "$(VERBOSE).SILENT\n";
+ makefileStream <<
+ "!ifndef VERBOSE\n"
+ ".SILENT\n"
+ "!endif\n"
+ ;
}
else
{
+ // Write special target to silence make output. This must be after
+ // the default target in case VERBOSE is set (which changes the
+ // name). The setting of CMAKE_VERBOSE_MAKEFILE to ON will cause a
+ // "VERBOSE=1" to be added as a make variable which will change the
+ // name of this special target. This gives a make-time choice to
+ // the user.
this->WriteMakeRule(makefileStream,
"Suppress display of executed commands.",
"$(VERBOSE).SILENT",
@@ -789,6 +848,8 @@ cmLocalUnixMakefileGenerator3
// Work-around for makes that drop rules that have no dependencies
// or commands.
+ cmGlobalUnixMakefileGenerator3* gg =
+ static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
std::string hack = gg->GetEmptyRuleHackDepends();
if(!hack.empty())
{
@@ -829,7 +890,7 @@ void cmLocalUnixMakefileGenerator3
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL);
+ runRule += this->Convert(cmakefileName,NONE,SHELL);
runRule += " 0";
std::vector<std::string> no_depends;
@@ -859,11 +920,11 @@ void cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::WriteConvenienceRule(std::ostream& ruleFileStream,
- const char* realTarget,
- const char* helpTarget)
+ const std::string& realTarget,
+ const std::string& helpTarget)
{
// A rule is only needed if the names are different.
- if(strcmp(realTarget, helpTarget) != 0)
+ if(realTarget != helpTarget)
{
// The helper target depends on the real target.
std::vector<std::string> depends;
@@ -886,7 +947,7 @@ cmLocalUnixMakefileGenerator3
{
std::string dir = this->HomeRelativeOutputPath;
dir += this->GetTargetDirectory(target);
- return this->Convert(dir.c_str(),NONE,UNCHANGED);
+ return this->Convert(dir,NONE,UNCHANGED);
}
@@ -947,7 +1008,9 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- this->AppendCustomDepend(depends, *i);
+ cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ this->Makefile);
+ this->AppendCustomDepend(depends, ccg);
}
}
@@ -955,14 +1018,14 @@ cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::AppendCustomDepend(std::vector<std::string>& depends,
- const cmCustomCommand& cc)
+ cmCustomCommandGenerator const& ccg)
{
- for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin();
- d != cc.GetDepends().end(); ++d)
+ for(std::vector<std::string>::const_iterator d = ccg.GetDepends().begin();
+ d != ccg.GetDepends().end(); ++d)
{
// Lookup the real name of the dependency in case it is a CMake target.
std::string dep;
- if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(),
+ if(this->GetRealDependency(*d, this->ConfigurationName,
dep))
{
depends.push_back(dep);
@@ -981,7 +1044,9 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- this->AppendCustomCommand(commands, *i, target, true, relative);
+ cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ this->Makefile);
+ this->AppendCustomCommand(commands, ccg, target, true, relative);
}
}
@@ -989,7 +1054,7 @@ cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::AppendCustomCommand(std::vector<std::string>& commands,
- const cmCustomCommand& cc,
+ cmCustomCommandGenerator const& ccg,
cmTarget* target,
bool echo_comment,
cmLocalGenerator::RelativeRoot relative,
@@ -1001,8 +1066,8 @@ cmLocalUnixMakefileGenerator3
// their comments generated elsewhere.
if(echo_comment)
{
- const char* comment = cc.GetComment();
- if(comment && *comment)
+ const char* comment = ccg.GetComment();
+ if(comment && !*comment)
{
this->AppendEcho(commands, comment,
cmLocalUnixMakefileGenerator3::EchoGenerate);
@@ -1010,9 +1075,9 @@ cmLocalUnixMakefileGenerator3
}
// if the command specified a working directory use it.
- const char* dir = this->Makefile->GetStartOutputDirectory();
- const char* workingDir = cc.GetWorkingDirectory();
- if(workingDir)
+ std::string dir = this->Makefile->GetStartOutputDirectory();
+ std::string workingDir = ccg.GetWorkingDirectory();
+ if(!workingDir.empty())
{
dir = workingDir;
}
@@ -1020,8 +1085,6 @@ cmLocalUnixMakefileGenerator3
{
*content << dir;
}
- cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(),
- this->Makefile);
// Add each command line to the set of commands.
std::vector<std::string> commands1;
@@ -1053,9 +1116,9 @@ cmLocalUnixMakefileGenerator3
// Convert the command to a relative path only if the current
// working directory will be the start-output directory.
bool had_slash = cmd.find("/") != cmd.npos;
- if(!workingDir)
+ if(workingDir.empty())
{
- cmd = this->Convert(cmd.c_str(),START_OUTPUT);
+ cmd = this->Convert(cmd,START_OUTPUT);
}
bool has_slash = cmd.find("/") != cmd.npos;
if(had_slash && !has_slash)
@@ -1066,7 +1129,8 @@ cmLocalUnixMakefileGenerator3
cmd = "./" + cmd;
}
std::string launcher =
- this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
+ this->MakeLauncher(ccg, target,
+ workingDir.empty()? START_OUTPUT : NONE);
cmd = launcher + this->ConvertShellCommand(cmd, NONE);
ccg.AppendArguments(c, cmd);
@@ -1112,7 +1176,7 @@ cmLocalUnixMakefileGenerator3
}
// Setup the proper working directory for the commands.
- this->CreateCDCommand(commands1, dir, relative);
+ this->CreateCDCommand(commands1, dir.c_str(), relative);
// push back the custom commands
commands.insert(commands.end(), commands1.begin(), commands1.end());
@@ -1120,9 +1184,9 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
std::string
-cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
- cmTarget* target,
- RelativeRoot relative)
+cmLocalUnixMakefileGenerator3::MakeLauncher(
+ cmCustomCommandGenerator const& ccg,
+ cmTarget* target, RelativeRoot relative)
{
// Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM";
@@ -1138,10 +1202,10 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
- const std::vector<std::string>& outputs = cc.GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
if(!outputs.empty())
{
- output = this->Convert(outputs[0].c_str(), relative, SHELL);
+ output = this->Convert(outputs[0], relative, SHELL);
}
vars.Output = output.c_str();
@@ -1171,7 +1235,7 @@ cmLocalUnixMakefileGenerator3
cleanfile += filename;
}
cleanfile += ".cmake";
- std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
+ std::string cleanfilePath = this->Convert(cleanfile, FULL);
cmsys::ofstream fout(cleanfilePath.c_str());
if(!fout)
{
@@ -1183,25 +1247,25 @@ cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator f = files.begin();
f != files.end(); ++f)
{
- std::string fc = this->Convert(f->c_str(),START_OUTPUT,UNCHANGED);
- fout << " " << this->EscapeForCMake(fc.c_str()) << "\n";
+ std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED);
+ fout << " " << this->EscapeForCMake(fc) << "\n";
}
fout << ")\n";
}
std::string remove = "$(CMAKE_COMMAND) -P ";
- remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
+ remove += this->Convert(cleanfile, START_OUTPUT, SHELL);
commands.push_back(remove);
// For the main clean rule add per-language cleaning.
if(!filename)
{
// Get the set of source languages in the target.
- std::set<cmStdString> languages;
+ std::set<std::string> languages;
target.GetLanguages(languages);
fout << "\n"
<< "# Per-language clean rules from dependency scanning.\n"
<< "foreach(lang";
- for(std::set<cmStdString>::const_iterator l = languages.begin();
+ for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
fout << " " << *l;
@@ -1267,14 +1331,14 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Use the native echo command.
cmd = "@echo ";
- cmd += this->EscapeForShell(line.c_str(), false, true);
+ cmd += this->EscapeForShell(line, false, true);
}
else
{
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
- cmd += this->EscapeForShell(line.c_str());
+ cmd += this->EscapeForShell(line);
}
commands.push_back(cmd);
}
@@ -1299,7 +1363,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
-::CreateMakeVariable(const char* sin, const char* s2in)
+::CreateMakeVariable(const std::string& sin, const std::string& s2in)
{
std::string s = sin;
std::string s2 = s2in;
@@ -1317,7 +1381,7 @@ cmLocalUnixMakefileGenerator3
// see if the variable has been defined before and return
// the modified version of the variable
- std::map<cmStdString, cmStdString>::iterator i =
+ std::map<std::string, std::string>::iterator i =
this->MakeVariableMap.find(unmodified);
if(i != this->MakeVariableMap.end())
{
@@ -1588,14 +1652,14 @@ cmLocalUnixMakefileGenerator3
langs.begin(); li != langs.end(); ++li)
{
// construct the checker
- std::string lang = li->c_str();
+ std::string lang = *li;
// Create the scanner for this language
cmDepends *scanner = 0;
if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM")
{
// TODO: Handle RC (resource files) dependencies correctly.
- scanner = new cmDependsC(this, targetDir, lang.c_str(), &validDeps);
+ scanner = new cmDependsC(this, targetDir, lang, &validDeps);
}
#ifdef CMAKE_BUILD_WITH_CMAKE
else if(lang == "Fortran")
@@ -1613,7 +1677,7 @@ cmLocalUnixMakefileGenerator3
scanner->SetLocalGenerator(this);
scanner->SetFileComparison
(this->GlobalGenerator->GetCMakeInstance()->GetFileComparison());
- scanner->SetLanguage(lang.c_str());
+ scanner->SetLanguage(lang);
scanner->SetTargetDirectory(dir.c_str());
scanner->Write(ruleFileStream, internalRuleFileStream);
@@ -1721,12 +1785,12 @@ void cmLocalUnixMakefileGenerator3
{
text = "Running external command ...";
}
- std::set<cmStdString>::const_iterator dit;
+ std::set<std::string>::const_iterator dit;
for ( dit = glIt->second.GetUtilities().begin();
dit != glIt->second.GetUtilities().end();
++ dit )
{
- depends.push_back(dit->c_str());
+ depends.push_back(*dit);
}
this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal);
@@ -1746,7 +1810,7 @@ void cmLocalUnixMakefileGenerator3
cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(),
- targetName.c_str(), depends, commands, true);
+ targetName, depends, commands, true);
// Provide a "/fast" version of the target.
depends.clear();
@@ -1766,7 +1830,7 @@ void cmLocalUnixMakefileGenerator3
}
targetName += "/fast";
this->WriteMakeRule(ruleFileStream, targetString.c_str(),
- targetName.c_str(), depends, commands, true);
+ targetName, depends, commands, true);
}
}
@@ -1786,15 +1850,15 @@ void cmLocalUnixMakefileGenerator3
cmOStringStream progCmd;
progCmd <<
"$(CMAKE_COMMAND) -E cmake_progress_start ";
- progCmd << this->Convert(progressDir.c_str(),
+ progCmd << this->Convert(progressDir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory();
progressFile += "/progress.marks";
std::string progressFileNameFull =
- this->ConvertToFullPath(progressFile.c_str());
- progCmd << " " << this->Convert(progressFileNameFull.c_str(),
+ this->ConvertToFullPath(progressFile);
+ progCmd << " " << this->Convert(progressFileNameFull,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
commands.push_back(progCmd.str());
@@ -1802,14 +1866,14 @@ void cmLocalUnixMakefileGenerator3
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
mf2Dir += "Makefile2";
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- recursiveTarget.c_str()));
+ recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
{
cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << this->Convert(progressDir.c_str(),
+ progCmd << this->Convert(progressDir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " 0";
@@ -1824,7 +1888,7 @@ void cmLocalUnixMakefileGenerator3
commands.clear();
depends.clear();
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
- recursiveTarget.c_str()));
+ recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
@@ -1854,7 +1918,7 @@ void cmLocalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
}
commands.push_back
- (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str()));
+ (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
@@ -1872,7 +1936,7 @@ void cmLocalUnixMakefileGenerator3
std::string runRule =
"$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)";
runRule += " --check-build-system ";
- runRule += this->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE,
+ runRule += this->Convert(cmakefileName,cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
runRule += " 1";
commands.push_back(runRule);
@@ -1905,7 +1969,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf,
for(std::vector<std::string>::iterator l = files.begin();
l != files.end(); ++l)
{
- std::string dir = cmSystemTools::GetFilenamePath(l->c_str());
+ std::string dir = cmSystemTools::GetFilenamePath(*l);
// Clear the implicit dependency makefile.
std::string dependFile = dir + "/depend.make";
@@ -1933,7 +1997,7 @@ void cmLocalUnixMakefileGenerator3
for(ImplicitDependLanguageMap::const_iterator
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
- cmakefileStream << " \"" << l->first.c_str() << "\"\n";
+ cmakefileStream << " \"" << l->first << "\"\n";
}
cmakefileStream << " )\n";
@@ -1944,7 +2008,7 @@ void cmLocalUnixMakefileGenerator3
l = implicitLangs.begin(); l != implicitLangs.end(); ++l)
{
cmakefileStream
- << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n";
+ << "set(CMAKE_DEPENDS_CHECK_" << l->first << "\n";
ImplicitDependFileMap const& implicitPairs = l->second;
// for each file pair
@@ -1964,11 +2028,11 @@ void cmLocalUnixMakefileGenerator3
std::string cidVar = "CMAKE_";
cidVar += l->first;
cidVar += "_COMPILER_ID";
- const char* cid = this->Makefile->GetDefinition(cidVar.c_str());
+ const char* cid = this->Makefile->GetDefinition(cidVar);
if(cid && *cid)
{
cmakefileStream
- << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \""
+ << "set(CMAKE_" << l->first << "_COMPILER_ID \""
<< cid << "\")\n";
}
}
@@ -1976,7 +2040,7 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
this->AddCompileDefinitions(defines, &target,
- this->ConfigurationName.c_str());
+ this->ConfigurationName);
if(!defines.empty())
{
cmakefileStream
@@ -1987,7 +2051,7 @@ void cmLocalUnixMakefileGenerator3
di != defines.end(); ++di)
{
cmakefileStream
- << " " << this->EscapeForCMake(di->c_str()) << "\n";
+ << " " << this->EscapeForCMake(*di) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2013,7 +2077,7 @@ void cmLocalUnixMakefileGenerator3
for(std::vector<std::string>::const_iterator tri = transformRules.begin();
tri != transformRules.end(); ++tri)
{
- cmakefileStream << " " << this->EscapeForCMake(tri->c_str()) << "\n";
+ cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n";
}
cmakefileStream
<< " )\n";
@@ -2034,7 +2098,7 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os)
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
-::GetRecursiveMakeCall(const char *makefile, const char* tgt)
+::GetRecursiveMakeCall(const char *makefile, const std::string& tgt)
{
// Call make on the given file.
std::string cmd;
@@ -2059,7 +2123,7 @@ cmLocalUnixMakefileGenerator3
}
// Add the target.
- if (tgt && tgt[0] != '\0')
+ if (!tgt.empty())
{
// The make target is always relative to the top of the build tree.
std::string tgt2 = this->Convert(tgt, HOME_OUTPUT);
@@ -2070,12 +2134,12 @@ cmLocalUnixMakefileGenerator3
// Escape one extra time if the make tool requires it.
if(this->MakeCommandEscapeTargetTwice)
{
- tgt2 = this->EscapeForShell(tgt2.c_str(), true, false);
+ tgt2 = this->EscapeForShell(tgt2, true, false);
}
// The target name is now a string that should be passed verbatim
// on the command line.
- cmd += this->EscapeForShell(tgt2.c_str(), true, false);
+ cmd += this->EscapeForShell(tgt2, true, false);
}
return cmd;
}
@@ -2198,7 +2262,7 @@ cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt)
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt,
- const char* lang,
+ const std::string& lang,
const char* obj,
const char* src)
{