summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-16 17:06:29 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-16 18:46:43 (GMT)
commit406f397e8b5524107457cc2d70bd22878350e9e1 (patch)
tree9ff09e0750b1b7e98c690f50da265869643afc43 /Tests/RunCMake
parentdd5c54600b6f651898925bfd9ec4406ccfc7be95 (diff)
downloadCMake-406f397e8b5524107457cc2d70bd22878350e9e1.zip
CMake-406f397e8b5524107457cc2d70bd22878350e9e1.tar.gz
CMake-406f397e8b5524107457cc2d70bd22878350e9e1.tar.bz2
math: Restore toleration of unexpected characters in an expression
Prior to commit 7c4c13ffef (math: Reject unexpected expression input explicitly, 2018-05-18) we ignored unexpected characters in an expression that otherwise can be parsed. In order to preserve compatibility with projects that accidentally used this, convert the error to a warning.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt5
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt8
-rw-r--r--Tests/RunCMake/math/MATH-ToleratedExpression.cmake4
-rw-r--r--Tests/RunCMake/math/RunCMakeTest.cmake1
4 files changed, 15 insertions, 3 deletions
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
index 18ac9f7..9e73ed5 100644
--- a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
@@ -1,6 +1,5 @@
^CMake Error at MATH-InvalidExpression.cmake:1 \(math\):
- *math cannot parse the expression: "INVALID": syntax error, unexpected
- *character, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER
- *\(1\).
+ math cannot parse the expression: "INVALID": syntax error, unexpected \$end,
+ expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER \(7\).
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
new file mode 100644
index 0000000..732ce6f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at MATH-ToleratedExpression.cmake:1 \(math\):
+ Unexpected character in expression at position 1: '
+
+ Unexpected character in expression at position 7: '
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/math/MATH-ToleratedExpression.cmake b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
new file mode 100644
index 0000000..d1be218
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-ToleratedExpression.cmake
@@ -0,0 +1,4 @@
+math(EXPR var "'2*1-1'")
+if(NOT var EQUAL 1)
+ message(FATAL_ERROR "Expression did not evaluate to 1")
+endif()
diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake
index 494b813..a4d5c31 100644
--- a/Tests/RunCMake/math/RunCMakeTest.cmake
+++ b/Tests/RunCMake/math/RunCMakeTest.cmake
@@ -5,4 +5,5 @@ run_cmake(MATH-WrongArgument)
run_cmake(MATH-DoubleOption)
run_cmake(MATH-TooManyArguments)
run_cmake(MATH-InvalidExpression)
+run_cmake(MATH-ToleratedExpression)
run_cmake(MATH-DivideByZero)