File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ std::vector<std::string> prepareFilesPathsForTree(
80
80
prepared.reserve (filesPaths.size ());
81
81
82
82
for (auto const & filePath : filesPaths) {
83
- prepared.push_back (prepareFilePathForTree (filePath, currentSourceDir));
83
+ // If provided file path is actually not a file, silently ignore it.
84
+ if (cmSystemTools::FileExists (filePath, /* isFile=*/ true )) {
85
+ prepared.push_back (prepareFilePathForTree (filePath, currentSourceDir));
86
+ }
84
87
}
85
88
86
89
return prepared;
Original file line number Diff line number Diff line change @@ -42,8 +42,16 @@ set(tree_files_with_prefix ${root}/tree_prefix_foo.c
42
42
set (tree_files_with_empty_prefix ${root} /tree_empty_prefix_foo.c
43
43
tree_empty_prefix_bar.c)
44
44
45
+ set (tree_files_which_are_actually_directories ${root}
46
+ ${root} /
47
+ ${root} /sub1
48
+ ${root} /sub1/)
49
+
45
50
source_group (TREE ${root} FILES ${tree_files_without_prefix} )
46
51
52
+ # Should not crash and not add any files - just silently ignore the directories
53
+ source_group (TREE ${root} FILES ${tree_files_which_are_actually_directories} )
54
+
47
55
source_group (FILES ${tree_files_with_prefix} PREFIX tree_root/subgroup TREE ${root} )
48
56
49
57
source_group (PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root} )
You can’t perform that action at this time.
0 commit comments