stringapi: Use strings for dependency information

This commit is contained in:
Ben Boeckel 2014-02-24 20:32:55 -05:00 committed by Brad King
parent 94fc63e2d5
commit 7abf4e313d
11 changed files with 22 additions and 24 deletions

View File

@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand
commandLines.push_back(commandLine); commandLines.push_back(commandLine);
// Add command for generating the .h and .cxx files // Add command for generating the .h and .cxx files
const char* no_main_dependency = 0; std::string no_main_dependency = "";
const char* no_comment = 0; const char* no_comment = 0;
const char* no_working_dir = 0; const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), this->Makefile->AddCustomCommandToOutput(cxxres.c_str(),

View File

@ -316,7 +316,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// file as the main dependency because it would get // file as the main dependency because it would get
// overwritten by the CreateVCProjBuildRule. // overwritten by the CreateVCProjBuildRule.
// (this could be avoided with per-target source files) // (this could be avoided with per-target source files)
const char* no_main_dependency = 0; std::string no_main_dependency = "";
if(cmSourceFile* file = if(cmSourceFile* file =
mf->AddCustomCommandToOutput( mf->AddCustomCommandToOutput(
stamps, listFiles, stamps, listFiles,

View File

@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
this->Makefile->AddCustomCommandToOutput( this->Makefile->AddCustomCommandToOutput(
targetFullPath.c_str(), targetFullPath.c_str(),
objVector, objVector,
0, "",
commandLines, commandLines,
comment.c_str(), comment.c_str(),
this->Makefile->GetStartOutputDirectory() this->Makefile->GetStartOutputDirectory()

View File

@ -578,7 +578,7 @@ cmLocalVisualStudio6Generator
std::string comment = this->ConstructComment(origCommand, "<hack>"); std::string comment = this->ConstructComment(origCommand, "<hack>");
// Add the rule with the given dependencies and commands. // Add the rule with the given dependencies and commands.
const char* no_main_dependency = 0; std::string no_main_dependency = "";
if(cmSourceFile* outsf = if(cmSourceFile* outsf =
this->Makefile->AddCustomCommandToOutput( this->Makefile->AddCustomCommandToOutput(
output, depends, no_main_dependency, output, depends, no_main_dependency,

View File

@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force_command.push_back("."); force_command.push_back(".");
cmCustomCommandLines force_commands; cmCustomCommandLines force_commands;
force_commands.push_back(force_command); force_commands.push_back(force_command);
const char* no_main_dependency = 0; std::string no_main_dependency = "";
std::string force = this->Makefile->GetStartOutputDirectory(); std::string force = this->Makefile->GetStartOutputDirectory();
force += cmake::GetCMakeFilesDirectory(); force += cmake::GetCMakeFilesDirectory();
force += "/"; force += "/";

View File

@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target,
cmSourceFile* cmSourceFile*
cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* main_dependency, const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment, const char* comment,
const char* workingDir, const char* workingDir,
@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Choose a source file on which to store the custom command. // Choose a source file on which to store the custom command.
cmSourceFile* file = 0; cmSourceFile* file = 0;
if(main_dependency && main_dependency[0]) if(!main_dependency.empty())
{ {
// The main dependency was specified. Use it unless a different // The main dependency was specified. Use it unless a different
// custom command already used it. // custom command already used it.
@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs,
// Construct a complete list of dependencies. // Construct a complete list of dependencies.
std::vector<std::string> depends2(depends); std::vector<std::string> depends2(depends);
if(main_dependency && main_dependency[0]) if(!main_dependency.empty())
{ {
depends2.push_back(main_dependency); depends2.push_back(main_dependency);
} }
@ -1104,7 +1104,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output,
cmSourceFile* cmSourceFile*
cmMakefile::AddCustomCommandToOutput(const std::string& output, cmMakefile::AddCustomCommandToOutput(const std::string& output,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* main_dependency, const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment, const char* comment,
const char* workingDir, const char* workingDir,
@ -1123,7 +1123,7 @@ void
cmMakefile::AddCustomCommandOldStyle(const std::string& target, cmMakefile::AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* source, const std::string& source,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment) const char* comment)
{ {
@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target,
else else
{ {
// The source may not be a real file. Do not use a main dependency. // The source may not be a real file. Do not use a main dependency.
const char* no_main_dependency = 0; std::string no_main_dependency = "";
std::vector<std::string> depends2 = depends; std::vector<std::string> depends2 = depends;
depends2.push_back(source); depends2.push_back(source);
sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency, sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency,
@ -1251,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
force += cmake::GetCMakeFilesDirectory(); force += cmake::GetCMakeFilesDirectory();
force += "/"; force += "/";
force += utilityName; force += utilityName;
const char* no_main_dependency = 0; std::string no_main_dependency = "";
bool no_replace = false; bool no_replace = false;
this->AddCustomCommandToOutput(force.c_str(), depends, this->AddCustomCommandToOutput(force.c_str(), depends,
no_main_dependency, no_main_dependency,

View File

@ -177,7 +177,7 @@ public:
cmSourceFile* AddCustomCommandToOutput( cmSourceFile* AddCustomCommandToOutput(
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* main_dependency, const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir, const char* comment, const char* workingDir,
bool replace = false, bool replace = false,
@ -185,7 +185,7 @@ public:
cmSourceFile* AddCustomCommandToOutput( cmSourceFile* AddCustomCommandToOutput(
const std::string& output, const std::string& output,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* main_dependency, const std::string& main_dependency,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment, const char* workingDir, const char* comment, const char* workingDir,
bool replace = false, bool replace = false,
@ -193,7 +193,7 @@ public:
void AddCustomCommandOldStyle(const std::string& target, void AddCustomCommandOldStyle(const std::string& target,
const std::vector<std::string>& outputs, const std::vector<std::string>& outputs,
const std::vector<std::string>& depends, const std::vector<std::string>& depends,
const char* source, const std::string& source,
const cmCustomCommandLines& commandLines, const cmCustomCommandLines& commandLines,
const char* comment); const char* comment);

View File

@ -1496,7 +1496,8 @@ cmMakefileTargetGenerator
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, void cmMakefileTargetGenerator::WriteTargetDriverRule(
const std::string& main_output,
bool relink) bool relink)
{ {
// Compute the name of the driver target. // Compute the name of the driver target.
@ -1510,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output,
// Build the list of target outputs to drive. // Build the list of target outputs to drive.
std::vector<std::string> depends; std::vector<std::string> depends;
if(main_output)
{
depends.push_back(main_output); depends.push_back(main_output);
}
const char* comment = 0; const char* comment = 0;
if(relink) if(relink)

View File

@ -119,7 +119,7 @@ protected:
std::string::size_type limit = std::string::npos); std::string::size_type limit = std::string::npos);
// write the driver rule to build target outputs // write the driver rule to build target outputs
void WriteTargetDriverRule(const char* main_output, bool relink); void WriteTargetDriverRule(const std::string& main_output, bool relink);
void DriveCustomCommands(std::vector<std::string>& depends); void DriveCustomCommands(std::vector<std::string>& depends);

View File

@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn,
depends.push_back(moc_exe); depends.push_back(moc_exe);
depends.push_back(hname); depends.push_back(hname);
const char* no_main_dependency = 0; std::string no_main_dependency = "";
const char* no_working_dir = 0; const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(newName.c_str(), this->Makefile->AddCustomCommandToOutput(newName.c_str(),
depends, depends,

View File

@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn,
std::vector<std::string> depends; std::vector<std::string> depends;
depends.push_back(uiName); depends.push_back(uiName);
const char* no_main_dependency = 0; std::string no_main_dependency = "";
const char* no_comment = 0; const char* no_comment = 0;
const char* no_working_dir = 0; const char* no_working_dir = 0;
this->Makefile->AddCustomCommandToOutput(hName.c_str(), this->Makefile->AddCustomCommandToOutput(hName.c_str(),