[cmake-commits] alex committed cmInstallTargetGenerator.h 1.10 1.11 cmInstallTargetGenerator.cxx 1.34 1.35

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jun 15 11:12:09 EDT 2007


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

Modified Files:
	cmInstallTargetGenerator.h cmInstallTargetGenerator.cxx 
Log Message:

BUG: don't run strip on OPTIONAL install targets if the file doesn't exist

Alex


Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cmInstallTargetGenerator.h	17 May 2007 17:20:44 -0000	1.10
+++ cmInstallTargetGenerator.h	15 Jun 2007 15:12:06 -0000	1.11
@@ -44,9 +44,12 @@
   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& destinationFilename);
-  void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
-                     const std::string& destinationFilename);
+  void AddStripRule(std::ostream& os, 
+                    const std::string& quotedFullDestinationFilename, 
+                    bool optional);
+  void AddRanlibRule(std::ostream& os, 
+                     cmTarget::TargetType type,
+                     const std::string& quotedFullDestinationFilename);
 
   cmTarget* Target;
   std::string Destination;

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmInstallTargetGenerator.cxx	22 May 2007 14:24:59 -0000	1.34
+++ cmInstallTargetGenerator.cxx	15 Jun 2007 15:12:07 -0000	1.35
@@ -177,13 +177,15 @@
     this->AddInstallNamePatchRule(os, destination.c_str());
     }
 
-  std::string destinationFilename = destination;
-  destinationFilename += "/";
-  destinationFilename += cmSystemTools::GetFilenameName(fromFile);
-
-  this->AddRanlibRule(os, type, destinationFilename);
+  std::string quotedFullDestinationFilename = "\"$ENV{DESTDIR}";
+  quotedFullDestinationFilename += destination;
+  quotedFullDestinationFilename += "/";
+  quotedFullDestinationFilename += cmSystemTools::GetFilenameName(fromFile);
+  quotedFullDestinationFilename += "\"";
+  
+  this->AddRanlibRule(os, type, quotedFullDestinationFilename);
 
-  this->AddStripRule(os, destinationFilename);
+  this->AddStripRule(os, quotedFullDestinationFilename, optional);
 }
 
 //----------------------------------------------------------------------------
@@ -451,7 +453,8 @@
 }
 
 void cmInstallTargetGenerator::AddStripRule(std::ostream& os, 
-                                        const std::string& destinationFilename)
+                              const std::string& quotedFullDestinationFilename,
+                              bool optional)
 {
 
   // Don't handle OSX Bundles.
@@ -466,16 +469,26 @@
     return;
     }
 
-  os << "IF(CMAKE_INSTALL_DO_STRIP)\n";
-  os << "  EXECUTE_PROCESS(COMMAND \"";
-  os << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP");
-  os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
-  os << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
+  os << "IF(CMAKE_INSTALL_DO_STRIP";
+  if (optional)
+    {
+    os << " AND EXISTS " << quotedFullDestinationFilename;
+    }
+  os << ")\n";
+  os << "  EXECUTE_PROCESS(COMMAND \""
+     << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP")
+     << "\" " << quotedFullDestinationFilename << " )\n";
+  os << "ENDIF(CMAKE_INSTALL_DO_STRIP";
+  if (optional)
+    {
+    os << " AND EXISTS " << quotedFullDestinationFilename;
+    }
+  os << ")\n";
 }
 
 void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, 
-                                        cmTarget::TargetType type,
-                                        const std::string& destinationFilename)
+                              cmTarget::TargetType type,
+                              const std::string& quotedFullDestinationFilename)
 {
   // Static libraries need ranlib on this platform.
   if(type != cmTarget::STATIC_LIBRARY)
@@ -499,5 +512,5 @@
 
   os << "EXECUTE_PROCESS(COMMAND \"";
   os << ranlib;
-  os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
+  os << "\" " << quotedFullDestinationFilename << " )\n";
 }



More information about the Cmake-commits mailing list