summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjrp2014 <jrp2014@users.noreply.github.com>2018-04-03 19:20:39 +0100
committerBrad King <brad.king@kitware.com>2018-04-04 14:42:20 -0400
commit0ad329f7c09f67aa2ebae059fbbef6266c8f6515 (patch)
tree115777343303ae5b01ec5178e0561ef87c06ae04
parent561238bb6f07a5ab31293928bd98f6f8911d8bc1 (diff)
downloadcmake-0ad329f7c09f67aa2ebae059fbbef6266c8f6515.tar.gz
Sanitize paths from LINK_DIRECTORIES directory property
Normally they are sanitized by the `link_directories` command before populating the property, but projects may set the property directly.
-rw-r--r--Source/cmMakefile.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3ecd7eb69a..bbe6cc9432 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1836,12 +1836,10 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
std::vector<std::string> linkDirs;
cmSystemTools::ExpandListArgument(linkDirsProp, linkDirs);
- for (std::string const& linkDir : linkDirs) {
- std::string newdir = linkDir;
- // remove trailing slashes
- if (*linkDir.rbegin() == '/') {
- newdir = linkDir.substr(0, linkDir.size() - 1);
- }
+ for (std::string& linkDir : linkDirs) {
+ // Sanitize the path the same way the link_directories command does
+ // in case projects set the LINK_DIRECTORIES property directly.
+ cmSystemTools::ConvertToUnixSlashes(linkDir);
target.AddLinkDirectory(linkDir);
}
}