summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorExpression.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-04-30 13:12:29 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2014-06-09 14:45:35 -0400
commit3e7194a215aed5e34acf32ad4b8c6bd948beb15e (patch)
treed64f0613579fdf8fda51ce8fd05f6045a3a2142e /Source/cmGeneratorExpression.cxx
parent9e8fa1043ce9bfcffdcfa395f618dd7958ef4251 (diff)
downloadcmake-3e7194a215aed5e34acf32ad4b8c6bd948beb15e.tar.gz
regex: Use static regexs where possible
Rather than declaring and compiling a constant regex every time a chunk of code is executed, build the regex once.
Diffstat (limited to 'Source/cmGeneratorExpression.cxx')
-rw-r--r--Source/cmGeneratorExpression.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 028d229675..2b4d955e0f 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -469,12 +469,11 @@ std::string::size_type cmGeneratorExpression::Find(const std::string &input)
//----------------------------------------------------------------------------
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_.:+-]+$");
+ static cmsys::RegularExpression targetNameValidator("^[A-Za-z0-9_.:+-]+$");
- return targetNameValidator.find(input.c_str());
+ return targetNameValidator.find(input);
}
//----------------------------------------------------------------------------