summaryrefslogtreecommitdiffstats
path: root/Source/cmFileSet.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-03-03 15:15:08 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-03-03 15:17:10 (GMT)
commitb357d334fc0c2f47ebc6a3a2b0ceba25d4818bb0 (patch)
treed925af359e631e47cfe061c6560fe0a443c04aec /Source/cmFileSet.cxx
parent04a7200c7561509a83c34f2af45b2d091ae59248 (diff)
downloadCMake-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/cmFileSet.cxx')
-rw-r--r--Source/cmFileSet.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmFileSet.cxx b/Source/cmFileSet.cxx
index 08d56ba..2c06dc6 100644
--- a/Source/cmFileSet.cxx
+++ b/Source/cmFileSet.cxx
@@ -7,6 +7,8 @@
#include <utility>
#include <vector>
+#include "cmsys/RegularExpression.hxx"
+
#include "cmGeneratorExpression.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -149,3 +151,11 @@ void cmFileSet::EvaluateFileEntry(
filesPerDir[relDir].push_back(file);
}
}
+
+bool cmFileSet::IsValidName(const std::string& name)
+{
+ static const cmsys::RegularExpression regex("^[a-z0-9][a-zA-Z0-9_]*$");
+
+ cmsys::RegularExpressionMatch match;
+ return regex.find(name.c_str(), match);
+}