diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-03-03 15:15:08 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-03-03 15:17:10 (GMT) |
commit | b357d334fc0c2f47ebc6a3a2b0ceba25d4818bb0 (patch) | |
tree | d925af359e631e47cfe061c6560fe0a443c04aec /Source/cmTargetSourcesCommand.cxx | |
parent | 04a7200c7561509a83c34f2af45b2d091ae59248 (diff) | |
download | CMake-b357d334fc0c2f47ebc6a3a2b0ceba25d4818bb0.zip CMake-b357d334fc0c2f47ebc6a3a2b0ceba25d4818bb0.tar.gz CMake-b357d334fc0c2f47ebc6a3a2b0ceba25d4818bb0.tar.bz2 |
target_sources(): Enforce stricter requirements for FILE_SET name
Fixes: #23286
Diffstat (limited to 'Source/cmTargetSourcesCommand.cxx')
-rw-r--r-- | Source/cmTargetSourcesCommand.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index b425acb..954fbb5 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -215,9 +215,10 @@ bool TargetSourcesImpl::HandleFileSetMode( auto fileSet = this->Target->GetOrCreateFileSet(args.FileSet, type); if (fileSet.second) { if (!isDefault) { - if (args.FileSet[0] >= 'A' && args.FileSet[0] <= 'Z') { - this->SetError( - "Non-default file set name must not start with a capital letter"); + if (!cmFileSet::IsValidName(args.FileSet)) { + this->SetError("Non-default file set name must contain only letters, " + "numbers, and underscores, and must not start with a " + "capital letter or underscore"); return false; } } |