[Cmake-commits] [cmake-commits] king committed cmInstallTargetGenerator.cxx 1.65 1.66 cmInstallTargetGenerator.h 1.26 1.27

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Oct 3 10:11:49 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv12639/Source

Modified Files:
	cmInstallTargetGenerator.cxx cmInstallTargetGenerator.h 
Log Message:
BUG: Fix config test for target install rules

In single-configuration generators a target installation rule should
apply to all configurations for which the INSTALL command was specified.
The configuration in which the target is built does not matter.

In multi-configuration generators each installation rule must be
associated with a particular build configuration to install the proper
file.  The set of configurations for which rules are generated is the
intersection of the build configurations and those for which the INSTALL
command was specified.


Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C 2 -d -r1.26 -r1.27
*** cmInstallTargetGenerator.h	8 Jul 2008 15:52:25 -0000	1.26
--- cmInstallTargetGenerator.h	3 Oct 2008 14:11:47 -0000	1.27
***************
*** 67,78 ****
    typedef cmInstallGeneratorIndent Indent;
    virtual void GenerateScript(std::ostream& os);
    void GenerateScriptForConfig(std::ostream& os,
-                                const char* fromDir,
                                 const char* config,
                                 Indent const& indent);
-   void GenerateScriptForConfigDir(std::ostream& os,
-                                   const char* fromDirConfig,
-                                   const char* config,
-                                   Indent const& indent);
    void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
                                 const char* config,
--- 67,75 ----
    typedef cmInstallGeneratorIndent Indent;
    virtual void GenerateScript(std::ostream& os);
+   virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
+   virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
    void GenerateScriptForConfig(std::ostream& os,
                                 const char* config,
                                 Indent const& indent);
    void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
                                 const char* config,
***************
*** 97,100 ****
--- 94,98 ----
    bool Optional;
    NamelinkModeType NamelinkMode;
+   std::string FromDir;
  };
  

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.65
retrieving revision 1.66
diff -C 2 -d -r1.65 -r1.66
*** cmInstallTargetGenerator.cxx	27 May 2008 14:21:21 -0000	1.65
--- cmInstallTargetGenerator.cxx	3 Oct 2008 14:11:47 -0000	1.66
***************
*** 58,71 ****
      }
  
-   // Track indentation.
-   Indent indent;
- 
-   // Begin this block of installation.
-   std::string component_test =
-     this->CreateComponentTest(this->Component.c_str());
-   os << indent << "IF(" << component_test << ")\n";
- 
    // Compute the build tree directory from which to copy the target.
!   std::string fromDir;
    if(this->Target->NeedRelinkBeforeInstall())
      {
--- 58,63 ----
      }
  
    // Compute the build tree directory from which to copy the target.
!   std::string& fromDir = this->FromDir;
    if(this->Target->NeedRelinkBeforeInstall())
      {
***************
*** 80,147 ****
      }
  
!   // Generate a portion of the script for each configuration.
    if(this->ConfigurationTypes->empty())
      {
!     this->GenerateScriptForConfig(os, fromDir.c_str(),
!                                   this->ConfigurationName,
!                                   indent.Next());
      }
    else
      {
      for(std::vector<std::string>::const_iterator i =
            this->ConfigurationTypes->begin();
          i != this->ConfigurationTypes->end(); ++i)
        {
!       this->GenerateScriptForConfig(os, fromDir.c_str(), i->c_str(),
!                                     indent.Next());
        }
      }
  
!   // End this block of installation.
!   os << indent << "ENDIF(" << component_test << ")\n\n";
  }
  
  //----------------------------------------------------------------------------
  void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
-                                                        const char* fromDir,
                                                         const char* config,
                                                         Indent const& indent)
  {
    // Compute the per-configuration directory containing the files.
!   std::string fromDirConfig = fromDir;
    this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()
      ->AppendDirectoryForConfig("", config, "/", fromDirConfig);
  
-   if(config && *config)
-     {
-     // Skip this configuration for config-specific installation that
-     // does not match it.
-     if(!this->InstallsForConfig(config))
-       {
-       return;
-       }
- 
-     // Generate a per-configuration block.
-     std::string config_test = this->CreateConfigTest(config);
-     os << indent << "IF(" << config_test << ")\n";
-     this->GenerateScriptForConfigDir(os, fromDirConfig.c_str(), config,
-                                      indent.Next());
-     os << indent << "ENDIF(" << config_test << ")\n";
-     }
-   else
-     {
-     this->GenerateScriptForConfigDir(os, fromDirConfig.c_str(), config,
-                                      indent);
-     }
- }
- 
- //----------------------------------------------------------------------------
- void
- cmInstallTargetGenerator
- ::GenerateScriptForConfigDir(std::ostream& os,
-                              const char* fromDirConfig,
-                              const char* config,
-                              Indent const& indent)
- {
    // Compute the full path to the main installed file for this target.
    NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
--- 72,131 ----
      }
  
!   // Perform the main install script generation.
!   this->cmInstallGenerator::GenerateScript(os);
! }
! 
! //----------------------------------------------------------------------------
! void cmInstallTargetGenerator::GenerateScriptConfigs(std::ostream& os,
!                                                      Indent const& indent)
! {
    if(this->ConfigurationTypes->empty())
      {
!     // In a single-configuration generator, only the install rule's
!     // configuration test is important.  If that passes, the target is
!     // installed regardless of for what configuration it was built.
!     this->cmInstallGenerator::GenerateScriptConfigs(os, indent);
      }
    else
      {
+     // In a multi-configuration generator, a separate rule is produced
+     // in a block for each configuration that is built.  However, the
+     // list of configurations is restricted to those for which this
+     // install rule applies.
      for(std::vector<std::string>::const_iterator i =
            this->ConfigurationTypes->begin();
          i != this->ConfigurationTypes->end(); ++i)
        {
!       const char* config = i->c_str();
!       if(this->InstallsForConfig(config))
!         {
!         // Generate a per-configuration block.
!         std::string config_test = this->CreateConfigTest(config);
!         os << indent << "IF(" << config_test << ")\n";
!         this->GenerateScriptForConfig(os, config, indent.Next());
!         os << indent << "ENDIF(" << config_test << ")\n";
!         }
        }
      }
+ }
  
! //----------------------------------------------------------------------------
! void cmInstallTargetGenerator::GenerateScriptActions(std::ostream& os,
!                                                      Indent const& indent)
! {
!   // This is reached for single-configuration generators only.
!   this->GenerateScriptForConfig(os, this->ConfigurationName, indent);
  }
  
  //----------------------------------------------------------------------------
  void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
                                                         const char* config,
                                                         Indent const& indent)
  {
    // Compute the per-configuration directory containing the files.
!   std::string fromDirConfig = this->FromDir;
    this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()
      ->AppendDirectoryForConfig("", config, "/", fromDirConfig);
  
    // Compute the full path to the main installed file for this target.
    NameType nameType = this->ImportLibrary? NameImplib : NameNormal;



More information about the Cmake-commits mailing list