Browse Source

Merge topic 'source_group-empty-prefix'

b3baa97e80 Source_Group: Allow an empty prefix with the TREE syntax.

Acked-by: Kitware Robot <[email protected]>
Merge-request: !2022
Brad King 7 years ago
parent
commit
4ac48237a0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Source/cmSourceGroupCommand.cxx

+ 5 - 1
Source/cmSourceGroupCommand.cxx

@@ -101,9 +101,13 @@ bool addFilesToItsSourceGroups(const std::string& root,
       tokenizedPath = tokenizePath(sgFilesPath);
     }
 
-    if (tokenizedPath.size() > 1) {
+    if (!tokenizedPath.empty()) {
       tokenizedPath.pop_back();
 
+      if (tokenizedPath.empty()) {
+        tokenizedPath.push_back("");
+      }
+
       sg = makefile.GetOrCreateSourceGroup(tokenizedPath);
 
       if (!sg) {