summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-06-27 20:10:39 (GMT)
committerBrad King <brad.king@kitware.com>2007-06-27 20:10:39 (GMT)
commitc0d3ab2d2b6a0e8d6cb1d380c7f1987f0a64a0f0 (patch)
tree046f26e512b8c3a0bc491395fd16e342b2fda4d8
parentcfe9fda9fe49c8b728cdae2074a49f65a021bacb (diff)
downloadCMake-c0d3ab2d2b6a0e8d6cb1d380c7f1987f0a64a0f0.zip
CMake-c0d3ab2d2b6a0e8d6cb1d380c7f1987f0a64a0f0.tar.gz
CMake-c0d3ab2d2b6a0e8d6cb1d380c7f1987f0a64a0f0.tar.bz2
BUG: Need to compute the correct versioned name for executables on cygwin. This addresses bug#5238.
-rw-r--r--Source/cmFileCommand.cxx45
-rw-r--r--Source/cmFileCommand.h3
2 files changed, 28 insertions, 20 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 80b9008..116bb5a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1700,10 +1700,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
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 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
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 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer,
}
//----------------------------------------------------------------------------
-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::ComputeVersionedName(std::string& name,
}
//----------------------------------------------------------------------------
+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)
{
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 542410f..39ef100 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -159,7 +159,8 @@ protected:
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);