diff options
author | Brad King <brad.king@kitware.com> | 2005-08-17 20:11:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-08-17 20:11:18 (GMT) |
commit | d392acb4e65e2ce133acf4a07dba983060f58725 (patch) | |
tree | 94e70b90a43f93849beccb3fb45131d5927a971b /Source/cmFileCommand.cxx | |
parent | 78112eef25772968412c32026b6a98f3817afe8d (diff) | |
download | CMake-d392acb4e65e2ce133acf4a07dba983060f58725.zip CMake-d392acb4e65e2ce133acf4a07dba983060f58725.tar.gz CMake-d392acb4e65e2ce133acf4a07dba983060f58725.tar.bz2 |
ENH: Added versioned executable support. This partially addresses bug#2143. Also made OUTPUT_NAME work when installing executables.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 7fd5910..64d3bd9 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -570,6 +570,9 @@ bool cmFileCommand::HandleInstallCommand( smanifest_files += soname.substr(destDirLength); } } + + // Reconstruct the source file path taking into account the + // extra directory and possible new file name. cmOStringStream str; str << cmSystemTools::GetFilenamePath(ctarget) << "/"; if ( extra_dir.size() > 0 ) @@ -581,14 +584,48 @@ bool cmFileCommand::HandleInstallCommand( } break; case cmTarget::EXECUTABLE: + { + // Handle executable versioning + const char* exe_version = 0; + if ( properties.find("VERSION") != properties.end() ) + { + exe_version = properties["VERSION"]; + } + if ( exe_version ) + { + std::string exename = destfile; + std::string exename_nopath = fname; + exename_nopath += "-"; + exename_nopath += exe_version; + + fname += "-"; + fname += exe_version; + destfile += "-"; + destfile += exe_version; + + cmSystemTools::RemoveFile(exename.c_str()); + + if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), exename.c_str()) ) + { + std::string errstring = "error when creating symlink from: " + exename + " to " + exename_nopath; + this->SetError(errstring.c_str()); + return false; + } + smanifest_files += ";"; + smanifest_files += exename.substr(destDirLength); + } + + // Reconstruct the source file path taking into account the + // extra directory and possible new file name. + cmOStringStream str; + str << cmSystemTools::GetFilenamePath(ctarget) << "/"; if ( extra_dir.size() > 0 ) { - cmOStringStream str; - str << cmSystemTools::GetFilenamePath(ctarget) - << "/" << extra_dir << "/" - << fname; - ctarget = str.str(); + str << extra_dir << "/"; } + str << fname; + ctarget = str.str(); + } break; } |