[cmake-commits] king committed cmFileCommand.cxx 1.84 1.85 cmFileCommand.h 1.26 1.27

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Jun 27 16:10:41 EDT 2007


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

Modified Files:
	cmFileCommand.cxx cmFileCommand.h 
Log Message:
BUG: Need to compute the correct versioned name for executables on cygwin.  This addresses bug#5238.


Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- cmFileCommand.h	13 Jun 2007 18:36:26 -0000	1.26
+++ cmFileCommand.h	27 Jun 2007 20:10:39 -0000	1.27
@@ -159,7 +159,8 @@
   bool HandleRelativePathCommand(std::vector<std::string> const& args);
   bool HandleCMakePathCommand(std::vector<std::string> const& args,
                               bool nativePath);
-  void ComputeVersionedName(std::string& name, const char* version);
+  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);

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- cmFileCommand.cxx	7 Jun 2007 17:51:17 -0000	1.84
+++ cmFileCommand.cxx	27 Jun 2007 20:10:39 -0000	1.85
@@ -1700,10 +1700,10 @@
           std::string libname = toFile;
           std::string soname = toFile;
           std::string soname_nopath = fromName;
-          this->ComputeVersionedName(soname, lib_soversion);
-          this->ComputeVersionedName(soname_nopath, lib_soversion);
-          this->ComputeVersionedName(fromName, lib_version);
-          this->ComputeVersionedName(toFile, lib_version);
+          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());
@@ -1743,22 +1743,14 @@
         if ( exe_version )
           {
           std::string exename = toFile;
-          std::string exename_nopath = fromName;
-          exename_nopath += "-";
-          exename_nopath += exe_version;
-
-          fromName += "-";
-          fromName += exe_version;
-          toFile += "-";
-          toFile += exe_version;
-
+          this->ComputeVersionedExeName(fromName, exe_version);
+          this->ComputeVersionedExeName(toFile, exe_version);
           cmSystemTools::RemoveFile(exename.c_str());
-
-          if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(),
-                                            exename.c_str()) )
+          if(!cmSystemTools::CreateSymlink(fromName.c_str(),
+                                           exename.c_str()))
             {
             std::string errstring = "error when creating symlink from: "
-              + exename + " to " + exename_nopath;
+              + exename + " to " + fromName;
             this->SetError(errstring.c_str());
             return false;
             }
@@ -1815,8 +1807,8 @@
 }
 
 //----------------------------------------------------------------------------
-void cmFileCommand::ComputeVersionedName(std::string& name,
-                                         const char* version)
+void cmFileCommand::ComputeVersionedLibName(std::string& name,
+                                            const char* version)
 {
 #if defined(__APPLE__)
   std::string ext;
@@ -1835,6 +1827,21 @@
 }
 
 //----------------------------------------------------------------------------
+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)
 {



More information about the Cmake-commits mailing list