From 46e5b9afe2e155aebc4eac0fed80ef98b23a0f7d Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Wed, 1 Jun 2005 13:37:49 -0400 Subject: ENH: minor perf improvement --- Source/cmLocalUnixMakefileGenerator3.cxx | 21 ++++++++++++++++----- Source/cmLocalUnixMakefileGenerator3.h | 11 ++++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f6a4816..b6541bd 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -55,6 +55,13 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3() } //---------------------------------------------------------------------------- +void cmLocalUnixMakefileGenerator3::Configure() +{ + this->ComputeHomeRelativeOutputPath(); + this->cmLocalGenerator::Configure(); +} + +//---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::Generate() { // Setup our configuration variables for this directory. @@ -259,17 +266,21 @@ void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os) << cmMakefile::GetMinorVersion() << "\n\n"; } -std::string cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() +void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() { // Include the rule file for each object. - std::string relPath = + m_HomeRelativeOutputPath = cmSystemTools::RelativePath(m_Makefile->GetHomeOutputDirectory(), m_Makefile->GetStartOutputDirectory()); - if (relPath.size()) + if (m_HomeRelativeOutputPath.size()) { - relPath += "/"; + m_HomeRelativeOutputPath += "/"; } - return relPath; +} + +const std::string &cmLocalUnixMakefileGenerator3::GetHomeRelativeOutputPath() +{ + return m_HomeRelativeOutputPath; } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index d107b25..ffeb0b8 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -43,12 +43,18 @@ public: */ virtual void Generate(); + /** + * Process the CMakeLists files for this directory to fill in the + * m_Makefile ivar + */ + virtual void Configure(); + /** creates the common disclainer text at the top of each makefile */ void WriteDisclaimer(std::ostream& os); // this returns the relative path between the HomeOutputDirectory and this // local generators StartOutputDirectory - std::string GetHomeRelativeOutputPath(); + const std::string &GetHomeRelativeOutputPath(); // Write out a make rule void WriteMakeRule(std::ostream& os, @@ -312,6 +318,7 @@ protected: std::string CreateMakeVariable(const char* sin, const char* s2in); //========================================================================== + void ComputeHomeRelativeOutputPath(); private: std::map m_CheckDependFiles; @@ -332,6 +339,8 @@ private: // Flag for whether echo command needs quotes. bool m_EchoNeedsQuote; + std::string m_HomeRelativeOutputPath; + // Set of object file names that will be built in this directory. std::set m_ObjectFiles; }; -- cgit v0.12