BUG: Do not create empty build-tree RPATH

The fix for issue #9130 appends ':' to the end of the build-tree RPATH
unconditionally.  This changes the fix to add ':' only when the RPATH is
not empty so that we do not create a build-tree RPATH with just ':'.  An
empty RPATH produces no string at all, so there is no chance of merging
with a symbol name anyway.
This commit is contained in:
Brad King 2009-06-11 14:57:47 -04:00
parent 3615950f12
commit 0d31c3aafb
1 changed files with 7 additions and 4 deletions

View File

@ -1708,10 +1708,13 @@ std::string cmComputeLinkInformation::GetRPathString(bool for_install)
// If the rpath will be replaced at install time, prepare space.
if(!for_install && this->RuntimeUseChrpath)
{
// Always add one trailing separator so the linker does not re-use
// the rpath .dynstr entry for a symbol name that happens to match
// the end of the rpath string.
rpath += this->GetRuntimeSep();
if(!rpath.empty())
{
// Add one trailing separator so the linker does not re-use the
// rpath .dynstr entry for a symbol name that happens to match
// the end of the rpath string.
rpath += this->GetRuntimeSep();
}
// Make sure it is long enough to hold the replacement value.
std::string::size_type minLength = this->GetChrpathString().length();