diff options
author | Brad King <brad.king@kitware.com> | 2014-03-10 19:47:19 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-12 14:44:01 (GMT) |
commit | bc993f277ebd44fabe8312a85c5682eed011336d (patch) | |
tree | 3f385f5257072c0eb18aa64badfe282eb41e3996 /Source/cmLocalVisualStudio6Generator.cxx | |
parent | 9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (diff) | |
download | CMake-bc993f277ebd44fabe8312a85c5682eed011336d.zip CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.gz CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.bz2 |
Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the
command lines of a custom command. Generalize it to get the comment,
working directory, dependencies, and outputs of custom commands. Update
use in all generators to support this.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d713024..2ab25cc 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -16,6 +16,7 @@ #include "cmSourceFile.h" #include "cmCacheManager.h" #include "cmGeneratorTarget.h" +#include "cmCustomCommandGenerator.h" #include "cmake.h" #include "cmComputeLinkInformation.h" @@ -59,6 +60,7 @@ public: } void Write(cmCustomCommand const& cc) { + cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile()); if(this->First) { this->Code += this->Event + "_Cmds="; @@ -68,7 +70,7 @@ public: { this->Code += "\\\n\t"; } - this->Code += this->LG->ConstructScript(cc, this->Config, "\\\n\t"); + this->Code += this->LG->ConstructScript(ccg, "\\\n\t"); } private: cmLocalVisualStudio6Generator* LG; @@ -575,14 +577,18 @@ cmLocalVisualStudio6Generator target.GetName().size() + 30)]; sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(), target.GetName().c_str(), count); - std::string comment = this->ConstructComment(origCommand, "<hack>"); + const char* comment = origCommand.GetComment(); + if(!comment && origCommand.GetOutputs().empty()) + { + comment = "<hack>"; + } // Add the rule with the given dependencies and commands. std::string no_main_dependency = ""; if(cmSourceFile* outsf = this->Makefile->AddCustomCommandToOutput( output, depends, no_main_dependency, - origCommand.GetCommandLines(), comment.c_str(), + origCommand.GetCommandLines(), comment, origCommand.GetWorkingDirectory().c_str())) { target.AddSourceFile(outsf); @@ -604,20 +610,21 @@ cmLocalVisualStudio6Generator const cmCustomCommand& command, const char* flags) { - std::string comment = - this->ConstructComment(command, "Building Custom Rule $(InputPath)"); - if(comment == "<hack>") - { - comment = ""; - } - // Write the rule for each configuration. std::vector<std::string>::iterator i; for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { std::string config = this->GetConfigName(*i); + cmCustomCommandGenerator ccg(command, config, this->Makefile); + std::string comment = + this->ConstructComment(ccg, "Building Custom Rule $(InputPath)"); + if(comment == "<hack>") + { + comment = ""; + } + std::string script = - this->ConstructScript(command, config.c_str(), "\\\n\t"); + this->ConstructScript(ccg, "\\\n\t"); if (i == this->Configurations.begin()) { @@ -634,8 +641,8 @@ cmLocalVisualStudio6Generator // Write out the dependencies for the rule. fout << "USERDEP__HACK="; for(std::vector<std::string>::const_iterator d = - command.GetDepends().begin(); - d != command.GetDepends().end(); + ccg.GetDepends().begin(); + d != ccg.GetDepends().end(); ++d) { // Lookup the real name of the dependency in case it is a CMake target. @@ -655,7 +662,7 @@ cmLocalVisualStudio6Generator fout << " " << comment.c_str(); } fout << "\n\n"; - if(command.GetOutputs().empty()) + if(ccg.GetOutputs().empty()) { fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t"; @@ -664,8 +671,8 @@ cmLocalVisualStudio6Generator else { for(std::vector<std::string>::const_iterator o = - command.GetOutputs().begin(); - o != command.GetOutputs().end(); + ccg.GetOutputs().begin(); + o != ccg.GetOutputs().end(); ++o) { // Write a rule for every output generated by this command. |