diff options
author | Brad King <brad.king@kitware.com> | 2019-11-05 16:31:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-05 16:31:16 (GMT) |
commit | 0ec60a400234624b258307a7944184828c8b6abc (patch) | |
tree | 86930d01495973c2714be1764e52786b363f4055 /Source | |
parent | 408a3a7d5e21d6b49af5d9b3b7e59f3286cd32b7 (diff) | |
parent | 3c0ca5a9d9d538da41e99207da22f55496bdf553 (diff) | |
download | CMake-0ec60a400234624b258307a7944184828c8b6abc.zip CMake-0ec60a400234624b258307a7944184828c8b6abc.tar.gz CMake-0ec60a400234624b258307a7944184828c8b6abc.tar.bz2 |
Merge branch 'source_group-tree' into release-3.16
Merge-request: !3979
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSourceGroupCommand.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 3a13e57..cc62952 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -78,10 +78,18 @@ std::vector<std::string> prepareFilesPathsForTree( 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(fullPath, /*isFile=*/true)) { - prepared.emplace_back(std::move(fullPath)); + // If provided file path is actually not a directory, silently ignore it. + if (cmSystemTools::FileIsDirectory(fullPath)) { + continue; } + + // Handle directory that doesn't exist yet. + if (!fullPath.empty() && + (fullPath.back() == '/' || fullPath.back() == '\\')) { + continue; + } + + prepared.emplace_back(std::move(fullPath)); } return prepared; |