[cmake-commits] king committed cmInstallDirectoryGenerator.cxx 1.4 1.5 cmInstallDirectoryGenerator.h 1.3 1.4 cmInstallExportGenerator.cxx 1.3 1.4 cmInstallExportGenerator.h 1.1 1.2 cmInstallFilesGenerator.cxx 1.8 1.9 cmInstallFilesGenerator.h 1.7 1.8 cmInstallGenerator.cxx 1.12 1.13 cmInstallGenerator.h 1.11 1.12 cmInstallScriptGenerator.cxx 1.2 1.3 cmInstallTargetGenerator.cxx 1.41 1.42 cmInstallTargetGenerator.h 1.16 1.17 cmInstallCommand.cxx 1.24 1.25 cmFileCommand.cxx 1.85 1.86 cmFileCommand.h 1.27 1.28

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Jul 2 14:56:59 EDT 2007


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

Modified Files:
	cmInstallDirectoryGenerator.cxx cmInstallDirectoryGenerator.h 
	cmInstallExportGenerator.cxx cmInstallExportGenerator.h 
	cmInstallFilesGenerator.cxx cmInstallFilesGenerator.h 
	cmInstallGenerator.cxx cmInstallGenerator.h 
	cmInstallScriptGenerator.cxx cmInstallTargetGenerator.cxx 
	cmInstallTargetGenerator.h cmInstallCommand.cxx 
	cmFileCommand.cxx cmFileCommand.h 
Log Message:
ENH: Further cleanup of installation script generation.  The per-component and per-configuration testing is now done in cmake code instead of in the FILE(INSTALL) command.  The generation of the cmake code to do these tests is centralized in cmInstallGenerator.  Old-style shared library versioning and component/config support code has been removed from FILE(INSTALL).  This commit is surrounded by the tags CMake-InstallGeneratorCleanup2-pre and CMake-InstallGeneratorCleanup2-post.


Index: cmInstallGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallGenerator.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cmInstallGenerator.h	2 Jul 2007 15:02:52 -0000	1.11
+++ cmInstallGenerator.h	2 Jul 2007 18:56:57 -0000	1.12
@@ -54,8 +54,9 @@
 class cmInstallGenerator
 {
 public:
-  cmInstallGenerator();
-  cmInstallGenerator(const char* dest):Destination(dest?dest:"") {}
+  cmInstallGenerator(const char* destination,
+                     std::vector<std::string> const& configurations,
+                     const char* component);
   virtual ~cmInstallGenerator();
 
   void Generate(std::ostream& os, const char* config,
@@ -68,21 +69,33 @@
     const char* properties = 0,
     const char* permissions_file = 0,
     const char* permissions_dir = 0,
-    std::vector<std::string> const& configurations 
-    = std::vector<std::string>(),
-    const char* component = 0,
     const char* rename = 0,
     const char* literal_args = 0,
     cmInstallGeneratorIndent const& indent = cmInstallGeneratorIndent()
     );
 
-  const char* GetDestination() const        {return this->Destination.c_str();}
+  const char* GetDestination() const
+    { return this->Destination.c_str(); }
+  const std::vector<std::string>& GetConfigurations() const
+    { return this->Configurations; }
 protected:
-  virtual void GenerateScript(std::ostream& os)=0;
+  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);
+
+  std::string CreateConfigTest(const char* config);
+  std::string CreateConfigTest(std::vector<std::string> const& configs);
+  std::string CreateComponentTest(const char* component);
 
+  // Information shared by most generator types.
+  std::string Destination;
+  std::vector<std::string> const Configurations;
+  std::string Component;
+
+  // Information used during generation.
   const char* ConfigurationName;
   std::vector<std::string> const* ConfigurationTypes;
-  std::string Destination;
 };
 
 #endif

Index: cmInstallGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallGenerator.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmInstallGenerator.cxx	2 Jul 2007 15:02:52 -0000	1.12
+++ cmInstallGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.13
@@ -21,10 +21,15 @@
 
 //----------------------------------------------------------------------------
 cmInstallGenerator
-::cmInstallGenerator()
+::cmInstallGenerator(const char* destination,
+                     std::vector<std::string> const& configurations,
+                     const char* component):
+  Destination(destination? destination:""),
+  Configurations(configurations),
+  Component(component? component:""),
+  ConfigurationName(0),
+  ConfigurationTypes(0)
 {
-  this->ConfigurationName = 0;
-  this->ConfigurationTypes = 0;
 }
 
 //----------------------------------------------------------------------------
@@ -57,8 +62,6 @@
                  const char* properties /* = 0 */,
                  const char* permissions_file /* = 0 */,
                  const char* permissions_dir /* = 0 */,
-                 std::vector<std::string> const& configurations,
-                 const char* component /* = 0 */,
                  const char* rename /* = 0 */,
                  const char* literal_args /* = 0 */,
                  cmInstallGeneratorIndent const& indent
@@ -99,19 +102,6 @@
     {
     os << " RENAME \"" << rename << "\"";
     }
-  if(!configurations.empty())
-    {
-    os << " CONFIGURATIONS";
-    for(std::vector<std::string>::const_iterator c = configurations.begin();
-        c != configurations.end(); ++c)
-      {
-      os << " \"" << *c << "\"";
-      }
-    }
-  if(component && *component)
-    {
-    os << " COMPONENTS \"" << component << "\"";
-    }
   os << " FILES";
   if(files.size() == 1)
     {
@@ -136,3 +126,115 @@
     }
   os << ")\n";
 }
+
+//----------------------------------------------------------------------------
+static void cmInstallGeneratorEncodeConfig(const char* config,
+                                           std::string& result)
+{
+  for(const char* c = config; *c; ++c)
+    {
+    if(*c >= 'a' && *c <= 'z')
+      {
+      result += "[";
+      result += *c + ('A' - 'a');
+      result += *c;
+      result += "]";
+      }
+    else if(*c >= 'A' && *c <= 'Z')
+      {
+      result += "[";
+      result += *c;
+      result += *c + ('a' - 'A');
+      result += "]";
+      }
+    else
+      {
+      result += *c;
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallGenerator::CreateConfigTest(const char* config)
+{
+  std::string result = "\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^(";
+  if(config && *config)
+    {
+    cmInstallGeneratorEncodeConfig(config, result);
+    }
+  result += ")$\"";
+  return result;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallGenerator::CreateConfigTest(std::vector<std::string> const& configs)
+{
+  std::string result = "\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^(";
+  const char* sep = "";
+  for(std::vector<std::string>::const_iterator ci = configs.begin();
+      ci != configs.end(); ++ci)
+    {
+    result += sep;
+    sep = "|";
+    cmInstallGeneratorEncodeConfig(ci->c_str(), result);
+    }
+  result += ")$\"";
+  return result;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallGenerator::CreateComponentTest(const char* component)
+{
+  std::string result = "NOT CMAKE_INSTALL_COMPONENT OR "
+    "\"${CMAKE_INSTALL_COMPONENT}\" MATCHES \"^(";
+  result += component;
+  result += ")$\"";
+  return result;
+}
+
+//----------------------------------------------------------------------------
+void cmInstallGenerator::GenerateScript(std::ostream& os)
+{
+  // 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";
+
+  // Generate the script possibly with per-configuration code.
+  this->GenerateScriptConfigs(os, indent.Next());
+
+  // End this block of installation.
+  os << indent << "ENDIF(" << component_test << ")\n";
+}
+
+//----------------------------------------------------------------------------
+void
+cmInstallGenerator::GenerateScriptConfigs(std::ostream& os,
+                                          Indent const& indent)
+{
+  if(this->Configurations.empty())
+    {
+    // This rule is for all configurations.
+    this->GenerateScriptActions(os, indent);
+    }
+  else
+    {
+    // Generate a per-configuration block.
+    std::string config_test = this->CreateConfigTest(this->Configurations);
+    os << indent << "IF(" << config_test << ")\n";
+    this->GenerateScriptActions(os, indent.Next());
+    os << indent << "ENDIF(" << config_test << ")\n";
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmInstallGenerator::GenerateScriptActions(std::ostream&, Indent const&)
+{
+  // No actions for this generator.
+}

Index: cmInstallExportGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallExportGenerator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmInstallExportGenerator.h	19 Jun 2007 17:10:21 -0000	1.1
+++ cmInstallExportGenerator.h	2 Jul 2007 18:56:57 -0000	1.2
@@ -55,6 +55,7 @@
 public:
   cmInstallExportGenerator(const char* dest, const char* file_permissions,
                            const std::vector<std::string>& configurations,
+                           const char* component,
                            const char* filename, const char* prefix, 
                            const char* tempOutputDir);
 
@@ -73,14 +74,15 @@
     cmTargetWithProperties();
   };
 
+  typedef cmInstallGeneratorIndent Indent;
   virtual void GenerateScript(std::ostream& os);
+  virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
   static bool AddInstallLocations(cmTargetWithProperties *twp, 
                                   cmInstallTargetGenerator* generator,
                                   const char* prefix);
 
   std::string Name;
   std::string FilePermissions;
-  const std::vector<std::string> Configurations;
   std::string Filename;
   std::string Prefix;
   std::string TempOutputDir;

Index: cmInstallFilesGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmInstallFilesGenerator.h	19 Jun 2007 15:11:06 -0000	1.7
+++ cmInstallFilesGenerator.h	2 Jul 2007 18:56:57 -0000	1.8
@@ -35,12 +35,11 @@
   virtual ~cmInstallFilesGenerator();
 
 protected:
-  virtual void GenerateScript(std::ostream& os);
+  typedef cmInstallGeneratorIndent Indent;
+  virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
   std::vector<std::string> Files;
   bool Programs;
   std::string FilePermissions;
-  std::vector<std::string> Configurations;
-  std::string Component;
   std::string Rename;
   bool Optional;
 };

Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cmInstallTargetGenerator.h	2 Jul 2007 15:02:52 -0000	1.16
+++ cmInstallTargetGenerator.h	2 Jul 2007 18:56:57 -0000	1.17
@@ -40,8 +40,6 @@
   static std::string GetInstallFilename(cmTarget*target, const char* config, 
                                         bool implib, bool useSOName);
 
-  const std::vector<std::string>& GetConfigurations() const {return this->Configurations;}
-  
 protected:
   typedef cmInstallGeneratorIndent Indent;
   virtual void GenerateScript(std::ostream& os);
@@ -66,8 +64,6 @@
   cmTarget* Target;
   bool ImportLibrary;
   std::string FilePermissions;
-  std::vector<std::string> Configurations;
-  std::string Component;
   bool Optional;
 };
 

Index: cmInstallDirectoryGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallDirectoryGenerator.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmInstallDirectoryGenerator.cxx	28 Jun 2007 20:11:18 -0000	1.4
+++ cmInstallDirectoryGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.5
@@ -27,9 +27,8 @@
                               std::vector<std::string> const& configurations,
                               const char* component,
                               const char* literal_args):
-  cmInstallGenerator(dest), Directories(dirs),
+  cmInstallGenerator(dest, configurations, component), Directories(dirs),
   FilePermissions(file_permissions), DirPermissions(dir_permissions),
-  Configurations(configurations), Component(component),
   LiteralArguments(literal_args)
 {
 }
@@ -41,7 +40,9 @@
 }
 
 //----------------------------------------------------------------------------
-void cmInstallDirectoryGenerator::GenerateScript(std::ostream& os)
+void
+cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
+                                                   Indent const& indent)
 {
   // Write code to install the directories.
   bool not_optional = false;
@@ -53,6 +54,6 @@
                        not_optional, no_properties,
                        this->FilePermissions.c_str(),
                        this->DirPermissions.c_str(),
-                       this->Configurations, this->Component.c_str(),
-                       no_rename, this->LiteralArguments.c_str());
+                       no_rename, this->LiteralArguments.c_str(),
+                       indent);
 }

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- cmFileCommand.cxx	27 Jun 2007 20:10:39 -0000	1.85
+++ cmFileCommand.cxx	2 Jul 2007 18:56:57 -0000	1.86
@@ -1241,20 +1241,17 @@
   std::string rename = "";
   std::string destination = "";
 
-  std::set<cmStdString> components;
-  std::set<cmStdString> configurations;
   std::vector<std::string> files;
   int itype = cmTarget::INSTALL_FILES;
 
   std::map<cmStdString, const char*> properties;
   bool optional = false;
-  bool result = this->ParseInstallArgs(args, installer, components,
-                                       configurations, properties,
+  bool result = this->ParseInstallArgs(args, installer, properties,
                                        itype, rename, destination, files,
                                        optional);
   if (result == true)
     {
-    result = this->DoInstall(installer, components, configurations, properties,
+    result = this->DoInstall(installer, properties,
                              itype, rename, destination, files, optional);
     }
   return result;
@@ -1263,8 +1260,6 @@
 //----------------------------------------------------------------------------
 bool cmFileCommand::ParseInstallArgs(std::vector<std::string> const& args,
                                 cmFileInstaller& installer,
-                                std::set<cmStdString>& components,
-                                std::set<cmStdString>& configurations,
                                 std::map<cmStdString, const char*>& properties,
                                 int& itype,
                                 std::string& rename,
@@ -1278,8 +1273,6 @@
     bool doing_permissions_file = false;
     bool doing_permissions_dir = false;
     bool doing_permissions_match = false;
-    bool doing_components = false;
-    bool doing_configurations = false;
     bool use_given_permissions_file = false;
     bool use_given_permissions_dir = false;
     bool use_source_permissions = false;
@@ -1308,8 +1301,6 @@
         doing_properties = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "TYPE" && i < args.size()-1 )
         {
@@ -1332,8 +1323,6 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "RENAME" && i < args.size()-1 )
         {
@@ -1351,8 +1340,6 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "REGEX" && i < args.size()-1 )
         {
@@ -1370,8 +1357,6 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "EXCLUDE"  )
         {
@@ -1401,8 +1386,6 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "PERMISSIONS" )
         {
@@ -1420,8 +1403,6 @@
         doing_properties = false;
         doing_files = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "DIR_PERMISSIONS" )
         {
@@ -1438,8 +1419,6 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = true;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( *cstr == "USE_SOURCE_PERMISSIONS" )
         {
@@ -1455,43 +1434,25 @@
         doing_files = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         use_source_permissions = true;
         }
       else if ( *cstr == "COMPONENTS"  )
         {
-        if(current_match_rule)
-          {
-          cmOStringStream e;
-          e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
-          this->SetError(e.str().c_str());
-          return false;
-          }
-
-        doing_properties = false;
-        doing_files = false;
-        doing_permissions_file = false;
-        doing_permissions_dir = false;
-        doing_components = true;
-        doing_configurations = false;
+        cmOStringStream e;
+        e << "INSTALL called with old-style COMPONENTS argument.  "
+          << "This script was generated with an older version of CMake.  "
+          << "Re-run this cmake version on your build tree.";
+        this->SetError(e.str().c_str());
+        return false;
         }
       else if ( *cstr == "CONFIGURATIONS"  )
         {
-        if(current_match_rule)
-          {
-          cmOStringStream e;
-          e << "INSTALL does not allow \"" << *cstr << "\" after REGEX.";
-          this->SetError(e.str().c_str());
-          return false;
-          }
-
-        doing_properties = false;
-        doing_files = false;
-        doing_permissions_file = false;
-        doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = true;
+        cmOStringStream e;
+        e << "INSTALL called with old-style CONFIGURATIONS argument.  "
+          << "This script was generated with an older version of CMake.  "
+          << "Re-run this cmake version on your build tree.";
+        this->SetError(e.str().c_str());
+        return false;
         }
       else if ( *cstr == "FILES" && !doing_files)
         {
@@ -1507,8 +1468,6 @@
         doing_properties = false;
         doing_permissions_file = false;
         doing_permissions_dir = false;
-        doing_components = false;
-        doing_configurations = false;
         }
       else if ( doing_properties && i < args.size()-1 )
         {
@@ -1519,14 +1478,6 @@
         {
         files.push_back(*cstr);
         }
-      else if ( doing_components )
-        {
-        components.insert(*cstr);
-        }
-      else if ( doing_configurations )
-        {
-        configurations.insert(cmSystemTools::UpperCase(*cstr));
-        }
       else if(doing_permissions_file)
         {
         if(!installer.CheckPermissions(args[i], permissions_file))
@@ -1587,6 +1538,25 @@
       return false;
       }
 
+    if(properties.find("VERSION") != properties.end())
+      {
+      cmOStringStream e;
+      e << "INSTALL called with old-style VERSION property.  "
+        << "This script was generated with an older version of CMake.  "
+        << "Re-run this cmake version on your build tree.";
+      this->SetError(e.str().c_str());
+      return false;
+      }
+    if(properties.find("SOVERSION") != properties.end())
+      {
+      cmOStringStream e;
+      e << "INSTALL called with old-style SOVERSION property.  "
+        << "This script was generated with an older version of CMake.  "
+        << "Re-run this cmake version on your build tree.";
+      this->SetError(e.str().c_str());
+      return false;
+      }
+
     this->GetTargetTypeFromString(stype, itype);
 
     this->HandleInstallPermissions(installer,
@@ -1602,8 +1572,6 @@
 
 //----------------------------------------------------------------------------
 bool cmFileCommand::DoInstall( cmFileInstaller& installer,
-                              const std::set<cmStdString>& components,
-                              const std::set<cmStdString>& configurations,
                               std::map<cmStdString, const char*>& properties,
                               const int itype,
                               const std::string& rename,
@@ -1612,38 +1580,6 @@
                               const bool optional)
 {
   typedef std::set<cmStdString>::const_iterator iter_type;
-  // Check for component-specific installation.
-  const char* cmake_install_component =
-    this->Makefile->GetDefinition("CMAKE_INSTALL_COMPONENT");
-  if(cmake_install_component && *cmake_install_component)
-    {
-    // This install rule applies only if it is associated with the
-    // current component.
-    if(iter_type(components.find(cmake_install_component)) ==
-       components.end())
-      {
-      return true;
-      }
-    }
-
-  // Check for configuration-specific installation.
-  if(!configurations.empty())
-    {
-    std::string cmake_install_configuration = cmSystemTools::UpperCase(
-        this->Makefile->GetSafeDefinition("CMAKE_INSTALL_CONFIG_NAME"));
-    if(cmake_install_configuration.empty())
-      {
-      // No configuration specified for installation but this install
-      // rule is configuration-specific.  Skip it.
-      return true;
-      }
-    else if(iter_type(configurations.find(cmake_install_configuration)) ==
-            configurations.end())
-      {
-      // This rule is specific to a configuration not being installed.
-      return true;
-      }
-    }
 
   // Check whether files should be copied always or only if they have
   // changed.
@@ -1669,97 +1605,6 @@
       toFile += toName;
       }
 
-    // Handle type-specific installation details.
-    switch(itype)
-      {
-      case cmTarget::MODULE_LIBRARY:
-      case cmTarget::STATIC_LIBRARY:
-      case cmTarget::SHARED_LIBRARY:
-        {
-        // Handle shared library versioning
-        const char* lib_version = 0;
-        const char* lib_soversion = 0;
-        if ( properties.find("VERSION") != properties.end() )
-          {
-          lib_version = properties["VERSION"];
-          }
-        if ( properties.find("SOVERSION") != properties.end() )
-          {
-          lib_soversion = properties["SOVERSION"];
-          }
-        if ( !lib_version && lib_soversion )
-          {
-          lib_version = lib_soversion;
-          }
-        if ( !lib_soversion && lib_version )
-          {
-          lib_soversion = lib_version;
-          }
-        if ( lib_version && lib_soversion )
-          {
-          std::string libname = toFile;
-          std::string soname = toFile;
-          std::string soname_nopath = fromName;
-          this->ComputeVersionedLibName(soname, lib_soversion);
-          this->ComputeVersionedLibName(soname_nopath, lib_soversion);
-          this->ComputeVersionedLibName(fromName, lib_version);
-          this->ComputeVersionedLibName(toFile, lib_version);
-
-          cmSystemTools::RemoveFile(soname.c_str());
-          cmSystemTools::RemoveFile(libname.c_str());
-
-          if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(),
-                                            libname.c_str()) )
-            {
-            std::string errstring = "error when creating symlink from: "
-              + libname + " to " + soname_nopath;
-            this->SetError(errstring.c_str());
-            return false;
-            }
-          installer.ManifestAppend(libname);
-          if ( toFile != soname )
-            {
-            if ( !cmSystemTools::CreateSymlink(fromName.c_str(),
-                                               soname.c_str()) )
-              {
-              std::string errstring = "error when creating symlink from: "
-                + soname + " to " + fromName;
-              this->SetError(errstring.c_str());
-              return false;
-              }
-            installer.ManifestAppend(soname);
-            }
-          }
-        }
-        break;
-      case cmTarget::EXECUTABLE:
-        {
-        // Handle executable versioning
-        const char* exe_version = 0;
-        if ( properties.find("VERSION") != properties.end() )
-          {
-          exe_version = properties["VERSION"];
-          }
-        if ( exe_version )
-          {
-          std::string exename = toFile;
-          this->ComputeVersionedExeName(fromName, exe_version);
-          this->ComputeVersionedExeName(toFile, exe_version);
-          cmSystemTools::RemoveFile(exename.c_str());
-          if(!cmSystemTools::CreateSymlink(fromName.c_str(),
-                                           exename.c_str()))
-            {
-            std::string errstring = "error when creating symlink from: "
-              + exename + " to " + fromName;
-            this->SetError(errstring.c_str());
-            return false;
-            }
-          installer.ManifestAppend(exename);
-          }
-        }
-        break;
-      }
-
     // Construct the full path to the source file.  The file name may
     // have been changed above.
     std::string fromFile = fromDir;
@@ -1807,41 +1652,6 @@
 }
 
 //----------------------------------------------------------------------------
-void cmFileCommand::ComputeVersionedLibName(std::string& name,
-                                            const char* version)
-{
-#if defined(__APPLE__)
-  std::string ext;
-  cmsys_stl::string::size_type dot_pos = name.rfind(".");
-  if(dot_pos != name.npos)
-    {
-    ext = name.substr(dot_pos, name.npos);
-    name = name.substr(0, dot_pos);
-    }
-#endif
-  name += ".";
-  name += version;
-#if defined(__APPLE__)
-  name += ext;
-#endif
-}
-
-//----------------------------------------------------------------------------
-void cmFileCommand::ComputeVersionedExeName(std::string& name,
-                                            const char* version)
-{
-  std::string ext;
-  if(name.size() > 4 && name.substr(name.size()-4) == ".exe")
-    {
-    ext = ".exe";
-    name = name.substr(0, name.size()-4);
-    }
-  name += "-";
-  name += version;
-  name += ext;
-}
-
-//----------------------------------------------------------------------------
 bool cmFileCommand::HandleRelativePathCommand(
   std::vector<std::string> const& args)
 {

Index: cmInstallFilesGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmInstallFilesGenerator.cxx	28 Jun 2007 20:11:18 -0000	1.8
+++ cmInstallFilesGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.9
@@ -27,9 +27,10 @@
                           const char* component,
                           const char* rename,
                           bool optional):
-  cmInstallGenerator(dest), Files(files), Programs(programs),
-  FilePermissions(file_permissions), Configurations(configurations),
-  Component(component), Rename(rename), Optional(optional)
+  cmInstallGenerator(dest, configurations, component),
+  Files(files), Programs(programs),
+  FilePermissions(file_permissions),
+  Rename(rename), Optional(optional)
 {
 }
 
@@ -40,7 +41,8 @@
 }
 
 //----------------------------------------------------------------------------
-void cmInstallFilesGenerator::GenerateScript(std::ostream& os)
+void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
+                                                    Indent const& indent)
 {
   // Write code to install the files.
   const char* no_properties = 0;
@@ -52,7 +54,5 @@
                        this->Files,
                        this->Optional, no_properties,
                        this->FilePermissions.c_str(), no_dir_permissions,
-                       this->Configurations,
-                       this->Component.c_str(),
-                       this->Rename.c_str());
+                       this->Rename.c_str(), 0, indent);
 }

Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cmInstallCommand.cxx	27 Jun 2007 20:14:50 -0000	1.24
+++ cmInstallCommand.cxx	2 Jul 2007 18:56:57 -0000	1.25
@@ -1295,7 +1295,7 @@
 
     // Create the export install generator.
     cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator(
-                          destination, permissions.c_str(), configurations, 
+                          destination, permissions.c_str(), configurations, 0,
                           filename.c_str(), prefix.c_str(), cmakeDir.c_str());
 
     if (exportGenerator->SetExportSet(exportIt->c_str(),exportSet))

Index: cmInstallExportGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallExportGenerator.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cmInstallExportGenerator.cxx	28 Jun 2007 20:11:18 -0000	1.3
+++ cmInstallExportGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.4
@@ -23,13 +23,14 @@
 
 #include "cmInstallExportGenerator.h"
 
-cmInstallExportGenerator::cmInstallExportGenerator(const char* destination,
-    const char* file_permissions,
-    std::vector<std::string> const& configurations,
-    const char* filename, const char* prefix, const char* tempOutputDir)
-  :cmInstallGenerator(destination)
+cmInstallExportGenerator::cmInstallExportGenerator(
+  const char* destination,
+  const char* file_permissions,
+  std::vector<std::string> const& configurations,
+  const char* component,
+  const char* filename, const char* prefix, const char* tempOutputDir)
+  :cmInstallGenerator(destination, configurations, component)
   ,FilePermissions(file_permissions)
-  ,Configurations(configurations)
   ,Filename(filename)
   ,Prefix(prefix)
   ,TempOutputDir(tempOutputDir)
@@ -221,13 +222,19 @@
       exportFileStream << "                      )\n\n";
     }
 
+  // Perform the main install script generation.
+  this->cmInstallGenerator::GenerateScript(os);
+}
+
+//----------------------------------------------------------------------------
+void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
+                                                     Indent const& indent)
+{
   // install rule for the file created above
   std::vector<std::string> exportFile;
   exportFile.push_back(this->ExportFilename);
-  this->AddInstallRule(os, this->Destination.c_str(), cmTarget::INSTALL_FILES, 
-                       exportFile, false, 0, 
-                       this->FilePermissions.c_str(), 0, this->Configurations, 
-                       0, this->Filename.c_str(), 0);
-
+  this->AddInstallRule(os, this->Destination.c_str(), cmTarget::INSTALL_FILES,
+                       exportFile, false, 0,
+                       this->FilePermissions.c_str(),
+                       0, this->Filename.c_str(), 0, indent);
 }
-

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- cmInstallTargetGenerator.cxx	2 Jul 2007 15:31:10 -0000	1.41
+++ cmInstallTargetGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.42
@@ -22,8 +22,6 @@
 #include "cmake.h"
 
 // TODO:
-//   - Consolidate component/configuration checks across multiple
-//     install generators
 //   - Skip IF(EXISTS) checks if nothing is done with the installed file
 
 //----------------------------------------------------------------------------
@@ -32,9 +30,8 @@
                            const char* file_permissions,
                            std::vector<std::string> const& configurations,
                            const char* component, bool optional):
-  cmInstallGenerator(dest), Target(&t), ImportLibrary(implib),
-  FilePermissions(file_permissions), Configurations(configurations),
-  Component(component), Optional(optional)
+  cmInstallGenerator(dest, configurations, component), Target(&t),
+  ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional)
 {
   this->Target->SetHaveInstallRule(true);
 }
@@ -52,10 +49,8 @@
   Indent indent;
 
   // Begin this block of installation.
-  std::string component_test = "NOT CMAKE_INSTALL_COMPONENT OR "
-    "\"${CMAKE_INSTALL_COMPONENT}\" MATCHES \"^(";
-  component_test += this->Component;
-  component_test += ")$\"";
+  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.
@@ -95,34 +90,6 @@
 }
 
 //----------------------------------------------------------------------------
-static std::string cmInstallTargetGeneratorEncodeConfig(const char* config)
-{
-  std::string result;
-  for(const char* c = config; *c; ++c)
-    {
-    if(*c >= 'a' && *c <= 'z')
-      {
-      result += "[";
-      result += *c + ('A' - 'a');
-      result += *c;
-      result += "]";
-      }
-    else if(*c >= 'A' && *c <= 'Z')
-      {
-      result += "[";
-      result += *c;
-      result += *c + ('a' - 'A');
-      result += "]";
-      }
-    else
-      {
-      result += *c;
-      }
-    }
-  return result;
-}
-
-//----------------------------------------------------------------------------
 void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
                                                        const char* fromDir,
                                                        const char* config,
@@ -155,9 +122,7 @@
       }
 
     // Generate a per-configuration block.
-    config_test = "\"${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^(";
-    config_test += cmInstallTargetGeneratorEncodeConfig(config);
-    config_test += ")$\"";
+    std::string config_test = this->CreateConfigTest(config);
     os << indent << "IF(" << config_test << ")\n";
     this->GenerateScriptForConfigDir(os, fromDirConfig.c_str(), config,
                                      indent.Next());
@@ -221,12 +186,12 @@
         from1 += ".app";
         files.push_back(from1);
         type = cmTarget::INSTALL_DIRECTORY;
+        // Need to apply install_name_tool and stripping to binary
+        // inside bundle.
         toFullPath += ".app/Contents/MacOS/";
         toFullPath += this->GetInstallFilename(this->Target, config,
                                                this->ImportLibrary, false);
         literal_args += " USE_SOURCE_PERMISSIONS";
-        // TODO: Still need to apply install_name_tool and stripping
-        // to binaries inside bundle.
         }
       else
         {
@@ -284,13 +249,10 @@
   const char* no_dir_permissions = 0;
   const char* no_rename = 0;
   const char* no_properties = 0;
-  const char* no_component = 0;
-  std::vector<std::string> no_configurations;
   bool optional = this->Optional || this->ImportLibrary;
   this->AddInstallRule(os, this->Destination.c_str(), type, files,
                        optional, no_properties,
                        this->FilePermissions.c_str(), no_dir_permissions,
-                       no_configurations, no_component,
                        no_rename, literal_args.c_str(),
                        indent);
 

Index: cmInstallScriptGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallScriptGenerator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmInstallScriptGenerator.cxx	13 Apr 2006 02:04:50 -0000	1.2
+++ cmInstallScriptGenerator.cxx	2 Jul 2007 18:56:57 -0000	1.3
@@ -19,6 +19,7 @@
 //----------------------------------------------------------------------------
 cmInstallScriptGenerator
 ::cmInstallScriptGenerator(const char* script, bool code):
+  cmInstallGenerator(0, std::vector<std::string>(), 0),
   Script(script), Code(code)
 {
 }

Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cmFileCommand.h	27 Jun 2007 20:10:39 -0000	1.27
+++ cmFileCommand.h	2 Jul 2007 18:56:57 -0000	1.28
@@ -159,15 +159,11 @@
   bool HandleRelativePathCommand(std::vector<std::string> const& args);
   bool HandleCMakePathCommand(std::vector<std::string> const& args,
                               bool nativePath);
-  void ComputeVersionedLibName(std::string& name, const char* version);
-  void ComputeVersionedExeName(std::string& name, const char* version);
 
   // FILE(INSTALL ...) related functions
   bool HandleInstallCommand(std::vector<std::string> const& args);
   bool ParseInstallArgs(std::vector<std::string> const& args,
                         cmFileInstaller& installer,
-                        std::set<cmStdString>& components,
-                        std::set<cmStdString>& configurations,
                         std::map<cmStdString, const char*>& properties,
                         int& itype,
                         std::string& destination,
@@ -176,8 +172,6 @@
                         bool& optional
                        );
   bool DoInstall(cmFileInstaller& installer,
-                 const std::set<cmStdString>& components,
-                 const std::set<cmStdString>& configurations,
                  std::map<cmStdString, const char*>& properties,
                  const int itype,
                  const std::string& rename,

Index: cmInstallDirectoryGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallDirectoryGenerator.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cmInstallDirectoryGenerator.h	19 Jun 2007 15:11:06 -0000	1.3
+++ cmInstallDirectoryGenerator.h	2 Jul 2007 18:56:57 -0000	1.4
@@ -35,12 +35,11 @@
   virtual ~cmInstallDirectoryGenerator();
 
 protected:
-  virtual void GenerateScript(std::ostream& os);
+  typedef cmInstallGeneratorIndent Indent;
+  virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
   std::vector<std::string> Directories;
   std::string FilePermissions;
   std::string DirPermissions;
-  std::vector<std::string> Configurations;
-  std::string Component;
   std::string LiteralArguments;
 };
 



More information about the Cmake-commits mailing list