summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-04 14:06:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-04 14:07:03 (GMT)
commit31743aaf5d131b326fc05d07632cdb2844f26121 (patch)
tree6e5545d8fe6d06c47c066f5f03b0ddfec1354cfd /Source
parent8074e46a5c5ec5b2316d8cc6f3330d139590e0a3 (diff)
parent8c23ecbd93eb86f7316cdeb2cdc561d28ee95de7 (diff)
downloadCMake-31743aaf5d131b326fc05d07632cdb2844f26121.zip
CMake-31743aaf5d131b326fc05d07632cdb2844f26121.tar.gz
CMake-31743aaf5d131b326fc05d07632cdb2844f26121.tar.bz2
Merge topic 'file-set-multiple-names' into release-3.23
8c23ecbd93 target_sources(): Process multiple FILE_SET arguments per block Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7040
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTargetSourcesCommand.cxx33
1 files changed, 28 insertions, 5 deletions
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index b425acb..17af789 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -38,6 +38,14 @@ auto const FileSetArgsParser = cmArgumentParser<FileSetArgs>()
.Bind("BASE_DIRS"_s, &FileSetArgs::BaseDirs)
.Bind("FILES"_s, &FileSetArgs::Files);
+struct FileSetsArgs
+{
+ std::vector<std::vector<std::string>> FileSets;
+};
+
+auto const FileSetsArgsParser =
+ cmArgumentParser<FileSetsArgs>().Bind("FILE_SET"_s, &FileSetsArgs::FileSets);
+
class TargetSourcesImpl : public cmTargetPropCommandBase
{
public:
@@ -79,7 +87,7 @@ private:
bool prepend, bool system) override
{
if (!content.empty() && content.front() == "FILE_SET"_s) {
- return this->HandleFileSetMode(scope, content, prepend, system);
+ return this->HandleFileSetMode(scope, content);
}
return this->cmTargetPropCommandBase::PopulateTargetProperties(
scope, content, prepend, system);
@@ -105,8 +113,9 @@ private:
IsInterface isInterfaceContent, CheckCMP0076 checkCmp0076);
bool HandleFileSetMode(const std::string& scope,
- const std::vector<std::string>& content, bool prepend,
- bool system);
+ const std::vector<std::string>& content);
+ bool HandleOneFileSet(const std::string& scope,
+ const std::vector<std::string>& content);
};
std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
@@ -186,8 +195,22 @@ std::vector<std::string> TargetSourcesImpl::ConvertToAbsoluteContent(
}
bool TargetSourcesImpl::HandleFileSetMode(
- const std::string& scope, const std::vector<std::string>& content,
- bool /*prepend*/, bool /*system*/)
+ const std::string& scope, const std::vector<std::string>& content)
+{
+ auto args = FileSetsArgsParser.Parse(content);
+
+ for (auto& argList : args.FileSets) {
+ argList.emplace(argList.begin(), "FILE_SET"_s);
+ if (!this->HandleOneFileSet(scope, argList)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TargetSourcesImpl::HandleOneFileSet(
+ const std::string& scope, const std::vector<std::string>& content)
{
std::vector<std::string> unparsed;
auto args = FileSetArgsParser.Parse(content, &unparsed);