Browse Source

cmInstallFilesGenerator: Add reference to calling cmMakefile

Add a Makefile member to the cmInstallFilesGenerator class and
populate it on construction.  This will be useful in a following
change to evaluate generator expressions with proper context.
Brad King 11 years ago
parent
commit
f11f7b34a8

+ 10 - 6
Source/cmInstallCommand.cxx

@@ -32,10 +32,12 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
 }
 
 static cmInstallFilesGenerator* CreateInstallFilesGenerator(
+  cmMakefile* mf,
     const std::vector<std::string>& absFiles,
     const cmInstallCommandArguments& args, bool programs)
 {
-  return new cmInstallFilesGenerator(absFiles, args.GetDestination().c_str(),
+  return new cmInstallFilesGenerator(mf,
+                        absFiles, args.GetDestination().c_str(),
                         programs, args.GetPermissions().c_str(),
                         args.GetConfigurations(), args.GetComponent().c_str(),
                         args.GetRename().c_str(), args.GetOptional());
@@ -668,7 +670,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
         if (!privateHeaderArgs.GetDestination().empty())
           {
           privateHeaderGenerator =
-            CreateInstallFilesGenerator(absFiles, privateHeaderArgs, false);
+            CreateInstallFilesGenerator(this->Makefile, absFiles,
+                                        privateHeaderArgs, false);
           }
         else
           {
@@ -694,7 +697,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
         if (!publicHeaderArgs.GetDestination().empty())
           {
           publicHeaderGenerator =
-            CreateInstallFilesGenerator(absFiles, publicHeaderArgs, false);
+            CreateInstallFilesGenerator(this->Makefile, absFiles,
+                                        publicHeaderArgs, false);
           }
         else
           {
@@ -719,8 +723,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
         // Create the files install generator.
         if (!resourceArgs.GetDestination().empty())
           {
-          resourceGenerator = CreateInstallFilesGenerator(absFiles,
-                                                          resourceArgs, false);
+          resourceGenerator = CreateInstallFilesGenerator(
+            this->Makefile, absFiles, resourceArgs, false);
           }
         else
           {
@@ -888,7 +892,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
 
   // Create the files install generator.
   this->Makefile->AddInstallGenerator(
-                         CreateInstallFilesGenerator(absFiles, ica, programs));
+    CreateInstallFilesGenerator(this->Makefile, absFiles, ica, programs));
 
   //Tell the global generator about any installation component names specified.
   this->Makefile->GetLocalGenerator()->GetGlobalGenerator()

+ 1 - 1
Source/cmInstallFilesCommand.cxx

@@ -133,7 +133,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
                                        "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
   std::vector<std::string> no_configurations;
   this->Makefile->AddInstallGenerator(
-    new cmInstallFilesGenerator(this->Files,
+    new cmInstallFilesGenerator(this->Makefile, this->Files,
                                 destination.c_str(), false,
                                 no_permissions, no_configurations,
                                 no_component.c_str(), no_rename));

+ 3 - 1
Source/cmInstallFilesGenerator.cxx

@@ -13,7 +13,8 @@
 
 //----------------------------------------------------------------------------
 cmInstallFilesGenerator
-::cmInstallFilesGenerator(std::vector<std::string> const& files,
+::cmInstallFilesGenerator(cmMakefile* mf,
+                          std::vector<std::string> const& files,
                           const char* dest, bool programs,
                           const char* file_permissions,
                           std::vector<std::string> const& configurations,
@@ -21,6 +22,7 @@ cmInstallFilesGenerator
                           const char* rename,
                           bool optional):
   cmInstallGenerator(dest, configurations, component),
+  Makefile(mf),
   Files(files), Programs(programs),
   FilePermissions(file_permissions),
   Rename(rename), Optional(optional)

+ 6 - 1
Source/cmInstallFilesGenerator.h

@@ -14,13 +14,16 @@
 
 #include "cmInstallGenerator.h"
 
+class cmMakefile;
+
 /** \class cmInstallFilesGenerator
  * \brief Generate file installation rules.
  */
 class cmInstallFilesGenerator: public cmInstallGenerator
 {
 public:
-  cmInstallFilesGenerator(std::vector<std::string> const& files,
+  cmInstallFilesGenerator(cmMakefile* mf,
+                          std::vector<std::string> const& files,
                           const char* dest, bool programs,
                           const char* file_permissions,
                           std::vector<std::string> const& configurations,
@@ -31,6 +34,8 @@ public:
 
 protected:
   virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
+
+  cmMakefile* Makefile;
   std::vector<std::string> Files;
   bool Programs;
   std::string FilePermissions;

+ 1 - 1
Source/cmInstallProgramsCommand.cxx

@@ -94,7 +94,7 @@ void cmInstallProgramsCommand::FinalPass()
                                        "CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
   std::vector<std::string> no_configurations;
   this->Makefile->AddInstallGenerator(
-    new cmInstallFilesGenerator(this->Files,
+    new cmInstallFilesGenerator(this->Makefile, this->Files,
                                 destination.c_str(), true,
                                 no_permissions, no_configurations,
                                 no_component.c_str(), no_rename));