From 7abf4e313d8e8d59c38f402efaf9cca4e4a2d3ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 24 Feb 2014 20:32:55 -0500 Subject: stringapi: Use strings for dependency information --- Source/cmFLTKWrapUICommand.cxx | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmLocalGenerator.cxx | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefile.cxx | 14 +++++++------- Source/cmMakefile.h | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 10 ++++------ Source/cmMakefileTargetGenerator.h | 2 +- Source/cmQTWrapCPPCommand.cxx | 2 +- Source/cmQTWrapUICommand.cxx | 2 +- 11 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 4dd81be..dd99c43 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -78,7 +78,7 @@ bool cmFLTKWrapUICommand commandLines.push_back(commandLine); // 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_working_dir = 0; this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 08c1397..ab4380c 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -316,7 +316,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() // file as the main dependency because it would get // overwritten by the CreateVCProjBuildRule. // (this could be avoided with per-target source files) - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* file = mf->AddCustomCommandToOutput( stamps, listFiles, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cd9f9bd..761db48 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -747,7 +747,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->Makefile->AddCustomCommandToOutput( targetFullPath.c_str(), objVector, - 0, + "", commandLines, comment.c_str(), this->Makefile->GetStartOutputDirectory() diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 0e246a5..f1fd994 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -578,7 +578,7 @@ cmLocalVisualStudio6Generator std::string comment = this->ConstructComment(origCommand, ""); // Add the rule with the given dependencies and commands. - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; if(cmSourceFile* outsf = this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 0bbafd8..4491140 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -141,7 +141,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force_command.push_back("."); cmCustomCommandLines force_commands; force_commands.push_back(force_command); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; std::string force = this->Makefile->GetStartOutputDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index a083c78..92177c8 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -950,7 +950,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -980,7 +980,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Choose a source file on which to store the custom command. cmSourceFile* file = 0; - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { // The main dependency was specified. Use it unless a different // custom command already used it. @@ -1048,7 +1048,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector& outputs, // Construct a complete list of dependencies. std::vector depends2(depends); - if(main_dependency && main_dependency[0]) + if(!main_dependency.empty()) { depends2.push_back(main_dependency); } @@ -1104,7 +1104,7 @@ cmMakefile::UpdateOutputToSourceMap(std::string const& output, cmSourceFile* cmMakefile::AddCustomCommandToOutput(const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, @@ -1123,7 +1123,7 @@ void cmMakefile::AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment) { @@ -1160,7 +1160,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, else { // 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 depends2 = depends; depends2.push_back(source); sf = this->AddCustomCommandToOutput(output, depends2, no_main_dependency, @@ -1251,7 +1251,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += cmake::GetCMakeFilesDirectory(); force += "/"; force += utilityName; - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; bool no_replace = false; this->AddCustomCommandToOutput(force.c_str(), depends, no_main_dependency, diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index fb40c1b..460a85c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -177,7 +177,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::vector& outputs, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -185,7 +185,7 @@ public: cmSourceFile* AddCustomCommandToOutput( const std::string& output, const std::vector& depends, - const char* main_dependency, + const std::string& main_dependency, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDir, bool replace = false, @@ -193,7 +193,7 @@ public: void AddCustomCommandOldStyle(const std::string& target, const std::vector& outputs, const std::vector& depends, - const char* source, + const std::string& source, const cmCustomCommandLines& commandLines, const char* comment); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f0c9a3f..28a8f04 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1496,8 +1496,9 @@ cmMakefileTargetGenerator } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, - bool relink) +void cmMakefileTargetGenerator::WriteTargetDriverRule( + const std::string& main_output, + bool relink) { // Compute the name of the driver target. std::string dir = @@ -1510,10 +1511,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(const char* main_output, // Build the list of target outputs to drive. std::vector depends; - if(main_output) - { - depends.push_back(main_output); - } + depends.push_back(main_output); const char* comment = 0; if(relink) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 573ce22..bed945b 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -119,7 +119,7 @@ protected: std::string::size_type limit = std::string::npos); // 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& depends); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 0d3c994..ca007cb 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -97,7 +97,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, depends.push_back(moc_exe); depends.push_back(hname); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(newName.c_str(), depends, diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index a6a4b51..2a1129d 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -128,7 +128,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, std::vector depends; depends.push_back(uiName); - const char* no_main_dependency = 0; + std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; this->Makefile->AddCustomCommandToOutput(hName.c_str(), -- cgit v0.12