diff options
author | Brad King <brad.king@kitware.com> | 2010-12-07 13:44:54 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-12-08 17:29:20 -0500 |
commit | 6fe5b3db0b2ca3f9203a54589de0d744d59744c0 (patch) | |
tree | bbecd5ad76c08d490399c7b6877236c8baf8fa91 /Source | |
parent | ced1d5eccd4ae08a6431a5c163be3dd52ca9d59a (diff) | |
download | cmake-6fe5b3db0b2ca3f9203a54589de0d744d59744c0.tar.gz |
Simplify VS generator ConstructScript interface
Pass to cmLocalVisualStudioGenerator::ConstructScript a cmCustomCommand
instance instead of extracting arguments at all call sites.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 15 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 14 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.cxx | 10 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 16 |
5 files changed, 14 insertions, 47 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index b50c133458..851c52654b 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -65,13 +65,7 @@ public: { this->Code += "\\\n\t"; } - this->Code += - this->LG->ConstructScript(cc.GetCommandLines(), - cc.GetWorkingDirectory(), - this->Config, - cc.GetEscapeOldStyle(), - cc.GetEscapeAllowMakeVars(), - "\\\n\t"); + this->Code += this->LG->ConstructScript(cc, this->Config, "\\\n\t"); } private: cmLocalVisualStudio6Generator* LG; @@ -659,12 +653,7 @@ cmLocalVisualStudio6Generator { std::string config = this->GetConfigName(*i); std::string script = - this->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - config.c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars(), - "\\\n\t"); + this->ConstructScript(command, config.c_str(), "\\\n\t"); if (i == this->Configurations.begin()) { diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 9a87cc4c85..b22c429d53 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -546,12 +546,7 @@ public: { this->Stream << this->LG->EscapeForXML("\n"); } - std::string script = - this->LG->ConstructScript(cc.GetCommandLines(), - cc.GetWorkingDirectory(), - this->Config, - cc.GetEscapeOldStyle(), - cc.GetEscapeAllowMakeVars()); + std::string script = this->LG->ConstructScript(cc, this->Config); this->Stream << this->LG->EscapeForXML(script.c_str()); } private: @@ -1591,12 +1586,7 @@ WriteCustomRule(std::ostream& fout, << this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n"; } - std::string script = - this->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - i->c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()); + std::string script = this->ConstructScript(command, i->c_str()); fout << "\t\t\t\t\t<Tool\n" << "\t\t\t\t\tName=\"" << customTool << "\"\n" << "\t\t\t\t\tDescription=\"" diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index ed0b07fe13..79dd1dfc5f 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -151,13 +151,15 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements //---------------------------------------------------------------------------- std::string cmLocalVisualStudioGenerator -::ConstructScript(const cmCustomCommandLines& commandLines, - const char* workingDirectory, +::ConstructScript(cmCustomCommand const& cc, const char* configName, - bool escapeOldStyle, - bool escapeAllowMakeVars, const char* newline_text) { + const cmCustomCommandLines& commandLines = cc.GetCommandLines(); + const char* workingDirectory = cc.GetWorkingDirectory(); + bool escapeOldStyle = cc.GetEscapeOldStyle(); + bool escapeAllowMakeVars = cc.GetEscapeAllowMakeVars(); + // Avoid leading or trailing newlines. const char* newline = ""; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 6034b22c7a..551b01cf9e 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -18,6 +18,7 @@ class cmSourceFile; class cmSourceGroup; +class cmCustomCommand; /** \class cmLocalVisualStudioGenerator * \brief Base class for Visual Studio generators. @@ -31,11 +32,8 @@ public: cmLocalVisualStudioGenerator(); virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ - std::string ConstructScript(const cmCustomCommandLines& commandLines, - const char* workingDirectory, + std::string ConstructScript(cmCustomCommand const& cc, const char* configName, - bool escapeOldStyle, - bool escapeAllowMakeVars, const char* newline = "\n"); protected: diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1d885e0f4f..eb8320c480 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -367,13 +367,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, i != configs->end(); ++i) { std::string script = - cmVS10EscapeXML( - lg->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - i->c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()) - ); + cmVS10EscapeXML(lg->ConstructScript(command, i->c_str())); this->WritePlatformConfigTag("Message",i->c_str(), 3); (*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n"; this->WritePlatformConfigTag("Command", i->c_str(), 3); @@ -1460,13 +1454,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( script += pre; pre = "\n"; script += - cmVS10EscapeXML( - lg->ConstructScript(command.GetCommandLines(), - command.GetWorkingDirectory(), - configName.c_str(), - command.GetEscapeOldStyle(), - command.GetEscapeAllowMakeVars()) - ); + cmVS10EscapeXML(lg->ConstructScript(command, configName.c_str())); } comment = cmVS10EscapeComment(comment); this->WriteString("<Message>",3); |