[cmake-developers] New EVIS parser moving forward (3.1)
Ben Boeckel
ben.boeckel at kitware.com
Tue Feb 18 11:04:08 EST 2014
Since the current ExpandVariablesInString has all kinds of pitfalls and
corner cases plus how close to the core of CMake this code change is, it
seems that a policy is warranted. Since the new parser is fast enough,
in the WARN case, it will run both the new and the old parsers and warn
when the expansion is different (or causes errors) because of the new
rules.
The other parser improvements (generator expressions and list expansion)
have been split out so that they may make it into 3.0 (ideally).
Things that I plan on changing with the new EVIS parser:
- No more '(' or ')' allowed in literal variable names. Previously,
these were only allowed in quoted $ENV{} expansions (though with my
(admittedly) limited lex/yacc knowledge, I don't see why this was
allowed anyways). I don't think there's much of a loss here,
personally. There may be other allowed characters no longer allowed,
so for the sake of clarity, the only *literal* characters allowed in
variable names will be alphanumeric, '_', '-', '/', '+', and '.'. If
you really need other characters, this still works since variable
expansions are not looked at:
set(varname "parens(k)")
message("$ENV{${varname}}")
- @ expansion is no longer done in CMakeLists.txt, included files, for
modules. This is probably a little-known "feature" that I have no
problem with nuking from orbit (see bug #2722). To get @ expansion
with the new EVIS parser, either configure_file or string(CONFIGURE)
must be used. See the code and results from
Tests/RunCMake/Syntax/AtWithVariable*.cmake for some of the
weirdness the current @ expansion causes.
Are there any other corner cases I should consider banning as well? What
about behavior that should be allowed that currently isn't?
Brad informed me that Stephen Kelly is already working on two other
policies and CMP0050 is the latest on master, so I'll take CMP0053 for
the new EVIS parser behavior.
Thanks,
--Ben
More information about the cmake-developers
mailing list