From 71c0e1417bdc42fbcc48986c7cb7c26642c1f665 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 24 Jul 2009 13:31:34 -0400 Subject: ENH: Keep only FinalPass commands in memory In cmMakefile we save all invoked commands so that FinalPass can be called on them later. Most commands have no final pass, so we should keep only the few that do. --- Source/cmCommand.h | 5 +++++ Source/cmConfigureFileCommand.h | 1 + Source/cmExportLibraryDependencies.h | 1 + Source/cmFLTKWrapUICommand.h | 1 + Source/cmInstallFilesCommand.h | 1 + Source/cmInstallProgramsCommand.h | 2 ++ Source/cmLoadCommandCommand.cxx | 2 ++ Source/cmMakefile.cxx | 2 +- 8 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/cmCommand.h b/Source/cmCommand.h index ed00b78..1a85102 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -87,6 +87,11 @@ public: * writing to the cache can be done. */ virtual void FinalPass() {}; + + /** + * Does this command have a final pass? Query after InitialPass. + */ + virtual bool HasFinalPass() const { return false; } /** * This is a virtual constructor for the command. diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 4147c68..b65ced1 100644 --- a/Source/cmConfigureFileCommand.h +++ b/Source/cmConfigureFileCommand.h @@ -81,6 +81,7 @@ public: } virtual void FinalPass(); + virtual bool HasFinalPass() const { return !this->Immediate; } private: int ConfigureFile(); diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index b5997cc..75de7dc 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/Source/cmExportLibraryDependencies.h @@ -48,6 +48,7 @@ public: * specified by the command is accumulated. */ virtual void FinalPass(); + virtual bool HasFinalPass() const { return true; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index 4815534..ff74f07 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/Source/cmFLTKWrapUICommand.h @@ -52,6 +52,7 @@ public: * writing to the cache can be done. */ virtual void FinalPass(); + virtual bool HasFinalPass() const { return true; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 6262833..2ba7f61 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.h @@ -63,6 +63,7 @@ public: * writing to the cache can be done. */ virtual void FinalPass(); + virtual bool HasFinalPass() const { return !this->IsFilesForm; } /** * More documentation. diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 04fbb07..8f4713e 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.h @@ -64,6 +64,8 @@ public: */ virtual void FinalPass(); + virtual bool HasFinalPass() const { return true; } + /** * More documentation. */ diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index fe67443..218a1fc 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -68,6 +68,8 @@ public: * writing to the cache can be done. */ virtual void FinalPass(); + virtual bool HasFinalPass() const + { return this->info.FinalPass? true:false; } /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 84d82df..648639c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -415,7 +415,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, cmSystemTools::SetFatalErrorOccured(); } } - else + else if(pcmd->HasFinalPass()) { // use the command this->UsedCommands.push_back(pcmd.release()); -- cgit v0.12