[cmake-commits] alex committed cmFileCommand.cxx 1.78.2.1 1.78.2.2 cmInstallTargetGenerator.cxx 1.28.2.2 1.28.2.3 cmInstallTargetGenerator.h 1.9.2.1 1.9.2.2

cmake-commits at cmake.org cmake-commits at cmake.org
Mon May 14 17:02:20 EDT 2007


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

Modified Files:
      Tag: CMake-CrossCompileBasic
	cmFileCommand.cxx cmInstallTargetGenerator.cxx 
	cmInstallTargetGenerator.h 
Log Message:

ENH: move ranlib handling on _APPLE_CC_ from the file command to the
InstallTargetGenerator

Alex


Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- cmInstallTargetGenerator.h	14 May 2007 20:28:07 -0000	1.9.2.1
+++ cmInstallTargetGenerator.h	14 May 2007 21:02:18 -0000	1.9.2.2
@@ -18,8 +18,7 @@
 #define cmInstallTargetGenerator_h
 
 #include "cmInstallGenerator.h"
-
-class cmTarget;
+#include "cmTarget.h"
 
 /** \class cmInstallTargetGenerator
  * \brief Generate target installation rules.
@@ -45,8 +44,10 @@
   std::string GetScriptReference(cmTarget* target, const char* place,
                                  bool useSOName);
   void AddInstallNamePatchRule(std::ostream& os, const char* destination);
-  void AddStripRule(std::ostream& os, const std::string& destination,
-                    const std::string& fromFile);
+  void AddStripRule(std::ostream& os, const std::string& destinationFilename);
+  void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
+                     const std::string& destinationFilename);
+
   cmTarget* Target;
   std::string Destination;
   bool ImportLibrary;

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.28.2.2
retrieving revision 1.28.2.3
diff -u -d -r1.28.2.2 -r1.28.2.3
--- cmInstallTargetGenerator.cxx	14 May 2007 20:28:07 -0000	1.28.2.2
+++ cmInstallTargetGenerator.cxx	14 May 2007 21:02:18 -0000	1.28.2.3
@@ -19,7 +19,6 @@
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmTarget.h"
 #include "cmake.h"
 
 //----------------------------------------------------------------------------
@@ -179,7 +178,13 @@
     this->AddInstallNamePatchRule(os, destination.c_str());
     }
 
-    this->AddStripRule(os, destination, fromFile);
+    std::string destinationFilename = destination;
+    destinationFilename += "/";
+    destinationFilename += cmSystemTools::GetFilenameName(fromFile);
+
+    this->AddRanlibRule(os, type, destinationFilename);
+
+    this->AddStripRule(os, destinationFilename);
 }
 
 //----------------------------------------------------------------------------
@@ -440,8 +445,7 @@
 }
 
 void cmInstallTargetGenerator::AddStripRule(std::ostream& os, 
-                                            const std::string& destination,
-                                            const std::string& fromFile)
+                                            const std::string& destinationFilename)
 {
 
   // Don't handle OSX Bundles.
@@ -462,14 +466,12 @@
     return;
     }
 
-  std::string destinationFilename = "\"";
-  destinationFilename += destination;
-  destinationFilename += "/";
-  destinationFilename += cmSystemTools::GetFilenameName(fromFile);
-  destinationFilename += "\"";
-
+  std::string qoutedDestinationFilename = "\"";
+  qoutedDestinationFilename += destinationFilename;
+  qoutedDestinationFilename += "\"";
+  
   cmLocalGenerator::RuleVariables vars;
-  vars.BinaryFullInstallPath = destinationFilename.c_str();
+  vars.BinaryFullInstallPath = qoutedDestinationFilename.c_str();
 
   this->Target->GetMakefile()->
       GetLocalGenerator()->ExpandRuleVariables(stripRule, vars);
@@ -480,3 +482,30 @@
   os << " )\n";
   os << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
 }
+
+void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, 
+                                             cmTarget::TargetType type,
+                                             const std::string& destinationFilename)
+{
+  // Perform post-installation processing on the file depending
+  // on its type.
+#if defined(__APPLE_CC__)
+  // Static libraries need ranlib on this platform.
+  if(type != cmTarget::STATIC_LIBRARY)
+    {
+    return;
+    }
+  
+  std::string ranlib = this->Target->GetMakefile()->GetSafeDefinition("CMAKE_RANLIB");
+  if (!ranlib.size()>0)
+    {
+    return;
+    }
+
+  os << "EXECUTE_PROCESS(COMMAND \"";
+  os << ranlib << "\" \"";
+  os << destinationFilename;
+  os << "\" )\n";
+        
+#endif
+}

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.78.2.1
retrieving revision 1.78.2.2
diff -u -d -r1.78.2.1 -r1.78.2.2
--- cmFileCommand.cxx	14 May 2007 17:46:15 -0000	1.78.2.1
+++ cmFileCommand.cxx	14 May 2007 21:02:18 -0000	1.78.2.2
@@ -1774,24 +1774,6 @@
           {
           return false;
           }
-
-        // Perform post-installation processing on the file depending
-        // on its type.
-#if defined(__APPLE_CC__)
-        // Static libraries need ranlib on this platform.
-        if(itype == cmTarget::STATIC_LIBRARY)
-          {
-          std::string ranlib = "ranlib ";
-          ranlib += cmSystemTools::ConvertToOutputPath(toFile.c_str());
-          if(!cmSystemTools::RunSingleCommand(ranlib.c_str()))
-            {
-            std::string err = "ranlib failed: ";
-            err += ranlib;
-            this->SetError(err.c_str());
-            return false;
-            }
-          }
-#endif
         }
       else if(!optional)
         {



More information about the Cmake-commits mailing list