[Cmake-commits] CMake branch, master, updated. v3.14.3-790-g40852ee

Kitware Robot kwrobot at kitware.com
Tue Apr 30 10:33:02 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  40852eed8e304dffd7254d6790850e0a73766d9e (commit)
       via  8d93815d204b4827ff9f1280a73e55861c00f47c (commit)
      from  d0e6fc28334023a42fbae797ece8c8e8526dc1c3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=40852eed8e304dffd7254d6790850e0a73766d9e
commit 40852eed8e304dffd7254d6790850e0a73766d9e
Merge: d0e6fc2 8d93815
Author:     Kyle Edwards <kyle.edwards at kitware.com>
AuthorDate: Tue Apr 30 14:30:26 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Apr 30 10:30:35 2019 -0400

    Merge topic 'source_group-tree-files'
    
    8d93815d20 source_group command ensures that FILES arguments are actually files
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3265


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d93815d204b4827ff9f1280a73e55861c00f47c
commit 8d93815d204b4827ff9f1280a73e55861c00f47c
Author:     Mateusz Janek <stryku2393 at gmail.com>
AuthorDate: Thu Apr 25 20:51:40 2019 +0200
Commit:     Mateusz Janek <stryku2393 at gmail.com>
CommitDate: Thu Apr 25 20:51:40 2019 +0200

    source_group command ensures that FILES arguments are actually files

diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 2bc4c39..5cdacaa 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -80,7 +80,10 @@ std::vector<std::string> prepareFilesPathsForTree(
   prepared.reserve(filesPaths.size());
 
   for (auto const& filePath : filesPaths) {
-    prepared.push_back(prepareFilePathForTree(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));
+    }
   }
 
   return prepared;
diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt
index 813774d..a5740bb 100644
--- a/Tests/SourceGroups/CMakeLists.txt
+++ b/Tests/SourceGroups/CMakeLists.txt
@@ -42,8 +42,16 @@ set(tree_files_with_prefix ${root}/tree_prefix_foo.c
 set(tree_files_with_empty_prefix ${root}/tree_empty_prefix_foo.c
                                  tree_empty_prefix_bar.c)
 
+set(tree_files_which_are_actually_directories ${root}
+                                              ${root}/
+                                              ${root}/sub1
+                                              ${root}/sub1/)
+
 source_group(TREE ${root} FILES ${tree_files_without_prefix})
 
+# Should not crash and not add any files - just silently ignore the directories
+source_group(TREE ${root} FILES ${tree_files_which_are_actually_directories})
+
 source_group(FILES ${tree_files_with_prefix} PREFIX tree_root/subgroup TREE ${root})
 
 source_group(PREFIX "" FILES ${tree_files_with_empty_prefix} TREE ${root})

-----------------------------------------------------------------------

Summary of changes:
 Source/cmSourceGroupCommand.cxx   | 5 ++++-
 Tests/SourceGroups/CMakeLists.txt | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list