From b3baa97e80af96eaeb7d0599e2d00071a945f7b8 Mon Sep 17 00:00:00 2001 From: Yohann Benedic Date: Mon, 30 Apr 2018 14:19:11 +0200 Subject: Source_Group: Allow an empty prefix with the TREE syntax. When calling source_group(TREE 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 --- Source/cmSourceGroupCommand.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) { -- cgit v0.12