diff options
author | Yohann Benedic <yohann@de2600.ispfr.net> | 2018-04-30 12:19:11 (GMT) |
---|---|---|
committer | Yohann Benedic <yohann@de2600.ispfr.net> | 2018-04-30 14:44:08 (GMT) |
commit | b3baa97e80af96eaeb7d0599e2d00071a945f7b8 (patch) | |
tree | 126ea73e1e8061bb56fbd10f6a0991b3dd1af49f | |
parent | 81aeb065e9e76cef22f39002bfff31ed4d826e74 (diff) | |
download | CMake-b3baa97e80af96eaeb7d0599e2d00071a945f7b8.zip CMake-b3baa97e80af96eaeb7d0599e2d00071a945f7b8.tar.gz CMake-b3baa97e80af96eaeb7d0599e2d00071a945f7b8.tar.bz2 |
Source_Group: Allow an empty prefix with the TREE syntax.
When calling
source_group(TREE <root> PREFIX "" FILES ...)
the files located at the root directory were not assigned
to the correct source group: they were put in a default
group (e.g. "Source Files" in Visual Studio).
Fixes: #17608
-rw-r--r-- | Source/cmSourceGroupCommand.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 8c9b63c..c3df313 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/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) { |