summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-30 15:31:15 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-30 15:31:15 (GMT)
commit7d98cd0442d695df809378dcd5a1eb0c3fb0928a (patch)
tree48b7509f898e5f5c9700b1f11712ac40d037cd71
parent4053d5737d917c3cb34af5d510a65ca26ed1763e (diff)
parent93af8a2583e2ec8d067a2e8eda544dfc5d3d3b4f (diff)
downloadCMake-7d98cd0442d695df809378dcd5a1eb0c3fb0928a.zip
CMake-7d98cd0442d695df809378dcd5a1eb0c3fb0928a.tar.gz
CMake-7d98cd0442d695df809378dcd5a1eb0c3fb0928a.tar.bz2
Merge branch 'source_group-tree-files' into release-3.15
Merge-request: !3630
-rw-r--r--Source/cmSourceGroupCommand.cxx15
1 files changed, 4 insertions, 11 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 5cdacaa..04b4d72 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -63,15 +63,6 @@ bool rootIsPrefix(const std::string& root,
return true;
}
-std::string prepareFilePathForTree(const std::string& path,
- const std::string& currentSourceDir)
-{
- if (!cmSystemTools::FileIsFullPath(path)) {
- return cmSystemTools::CollapseFullPath(currentSourceDir + "/" + path);
- }
- return cmSystemTools::CollapseFullPath(path);
-}
-
std::vector<std::string> prepareFilesPathsForTree(
const std::vector<std::string>& filesPaths,
const std::string& currentSourceDir)
@@ -80,9 +71,11 @@ std::vector<std::string> prepareFilesPathsForTree(
prepared.reserve(filesPaths.size());
for (auto const& filePath : filesPaths) {
+ std::string fullPath =
+ cmSystemTools::CollapseFullPath(filePath, currentSourceDir);
// If provided file path is actually not a file, silently ignore it.
- if (cmSystemTools::FileExists(filePath, /*isFile=*/true)) {
- prepared.push_back(prepareFilePathForTree(filePath, currentSourceDir));
+ if (cmSystemTools::FileExists(fullPath, /*isFile=*/true)) {
+ prepared.emplace_back(std::move(fullPath));
}
}