Commit Graph

6 Commits

Author SHA1 Message Date
Brad King 6ffc432367 cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944)
While evaluating `if(MATCHES)` we get a `const char*` pointer to the
string to be matched.  On code like

    if(CMAKE_MATCH_COUNT MATCHES "Y")

the string to be matched may be owned by our own result variables.
We must move the value to our own buffer before clearing them.
Otherwise we risk reading freed storage.
2016-02-01 10:05:10 -05:00
Matt McCormick 14e49ed156 if: Add "TEST <test>" condition
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.
2015-08-03 09:22:25 -04:00
Brad King e5ca59b456 Tests: Move command failure cases into RunCMake infrastructure
Move failure cases from the CMake.{If,List,While,GetProperty} tests over
to the RunCMake.{if,list,while,get_property} tests to use the more
modern infrastructure.  This also avoids using REGEX_ESCAPE_STRING to
try to regex-match full paths.
2015-07-14 10:25:38 -04:00
Stephen Kelly 1ec1bf9f07 if(): Test the effect of cmMakefileCall use in elseif() handling. 2015-05-18 21:28:09 +02:00
Brad King d05a9bd1e6 Cygwin: Avoid legacy warnings in RunCMake.* tests
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2013-08-13 09:50:15 -04:00
Brad King 7378792b49 if: Add test for IS_DIRECTORY
Add a RunCMake.if test to cover if() command behavior.  Start with a
test for IS_DIRECTORY cases with an existing directory and a long path,
both with a trailing slash.
2013-05-28 11:35:32 -04:00