if(TEST TestNameThatExists) will return true if a test with the name
TestNameThatExists has been added with add_test. The syntax is similar
to if(TARGET TargetName). Since use of "TEST" as an argument to if()
could previously be interpreted as a non-keyword argument, add policy
CMP0064 to treat it as a keyword as NEW behavior.
With PushScope and PopScope, keeping track of another bit of data for
each scope isn't easy. Instead, store it as another CMake variable so it
gets implicitly tracked along with everything else.
This works in a revert of commit
7d674b5f0b.
This reverts commit v3.1.0-rc1~557^2~2 (ClearMatches: Only clear matches
which were actually set, 2014-03-12). The optimization did not track
the match count in the same scope as the variables, allowing possible
inconsistency.
Resolve conflicts in Source/cmIfCommand.cxx, Source/cmMakefile.cxx,
and Source/cmMakefile.h by moving the changes to the new location
of the code involved.