summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpression.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-02-06 12:32:15 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-02-07 15:21:08 (GMT)
commit7c0ec75cfa6860b53036fe46c005b84277cdbc24 (patch)
tree830a43484968760685ca2eeb07a5777d91f87a5e /Source/cmGeneratorExpression.cxx
parent92e98dd909bd399f508ff7c2f9657095ddc766cc (diff)
downloadCMake-7c0ec75cfa6860b53036fe46c005b84277cdbc24.zip
CMake-7c0ec75cfa6860b53036fe46c005b84277cdbc24.tar.gz
CMake-7c0ec75cfa6860b53036fe46c005b84277cdbc24.tar.bz2
De-duplicate validation of genex target names.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r--Source/cmGeneratorExpression.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index c9f784b..60bf179 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -371,10 +371,20 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input)
{
const std::string::size_type openpos = input.find("$<");
if (openpos != std::string::npos
- && input.find(">", openpos) != std::string::npos)
- {
- return openpos;
- }
+ && input.find(">", openpos) != std::string::npos)
+ {
+ return openpos;
}
return std::string::npos;
}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpression::IsValidTargetName(const std::string &input)
+{
+ cmsys::RegularExpression targetNameValidator;
+ // The ':' is supported to allow use with IMPORTED targets. At least
+ // Qt 4 and 5 IMPORTED targets use ':' as the namespace delimiter.
+ targetNameValidator.compile("^[A-Za-z0-9_.:-]+$");
+
+ return targetNameValidator.find(input.c_str());
+}