summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-06-05 17:45:43 (GMT)
committerBrad King <brad.king@kitware.com>2006-06-05 17:45:43 (GMT)
commit932e3524fc2d8ae331de5770540e9b463be8d76e (patch)
treea16aa4e87e8dfe6548c079080bb9a18cc4674372 /Source/cmFileCommand.cxx
parent7ebe4702db28d09cacca0b958c81ce2c3659699b (diff)
downloadCMake-932e3524fc2d8ae331de5770540e9b463be8d76e.zip
CMake-932e3524fc2d8ae331de5770540e9b463be8d76e.tar.gz
CMake-932e3524fc2d8ae331de5770540e9b463be8d76e.tar.bz2
ENH: Changing shared library versioned file names on OSX to conform to that platform's convention.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx33
1 files changed, 24 insertions, 9 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 27c5e58..b3bbb09 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -775,15 +775,10 @@ bool cmFileCommand::HandleInstallCommand(
std::string libname = toFile;
std::string soname = toFile;
std::string soname_nopath = fromName;
- soname += ".";
- soname += lib_soversion;
- soname_nopath += ".";
- soname_nopath += lib_soversion;
-
- fromName += ".";
- fromName += lib_version;
- toFile += ".";
- toFile += lib_version;
+ this->ComputeVersionedName(soname, lib_soversion);
+ this->ComputeVersionedName(soname_nopath, lib_soversion);
+ this->ComputeVersionedName(fromName, lib_version);
+ this->ComputeVersionedName(toFile, lib_version);
cmSystemTools::RemoveFile(soname.c_str());
cmSystemTools::RemoveFile(libname.c_str());
@@ -946,6 +941,26 @@ bool cmFileCommand::HandleInstallCommand(
}
//----------------------------------------------------------------------------
+void cmFileCommand::ComputeVersionedName(std::string& name,
+ const char* version)
+{
+#if defined(__APPLE__)
+ std::string ext;
+ kwsys_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
+}
+
+//----------------------------------------------------------------------------
bool cmFileCommand::HandleRelativePathCommand(
std::vector<std::string> const& args)
{