summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine
diff options
context:
space:
mode:
authorMichael Scott <michael.scott250@gmail.com>2015-12-21 21:39:27 (GMT)
committerBrad King <brad.king@kitware.com>2016-01-12 19:02:51 (GMT)
commit28f2d750edaf6ee1af660d3a0ae6792c65c47997 (patch)
tree3e22c760e48a58d34c9e337c9ffef0f6295f0ebe /Tests/RunCMake/CommandLine
parentb5009720d3020021f189570d72c099963795a5c5 (diff)
downloadCMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.zip
CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.gz
CMake-28f2d750edaf6ee1af660d3a0ae6792c65c47997.tar.bz2
Add -Werror and -Wno-error command-line options
Expand the -W set of cmake options to include support for the -Werror and -Wno-error format, which is used to control upgrading and downgrading warning and error messages. Implement support for these new formats for the dev and deprecated message types. Add tests and updated documentation for new options.
Diffstat (limited to 'Tests/RunCMake/CommandLine')
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg3-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt4
-rw-r--r--Tests/RunCMake/CommandLine/Werror_deprecated.cmake1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev-stderr.txt11
-rw-r--r--Tests/RunCMake/CommandLine/Werror_dev.cmake7
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt4
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake2
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt11
-rw-r--r--Tests/RunCMake/CommandLine/Wno-error_dev.cmake7
13 files changed, 74 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 5e2200f..e77ba1f 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -187,6 +187,14 @@ set(RunCMake_TEST_OPTIONS -Wdev)
run_cmake(Wdev)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Werror=dev)
+run_cmake(Werror_dev)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Wno-error=dev)
+run_cmake(Wno-error_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
# -Wdev should not override deprecated options if specified
set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated)
run_cmake(Wno-deprecated)
@@ -200,6 +208,11 @@ set(RunCMake_TEST_OPTIONS -Wdev)
run_cmake(Wdeprecated)
unset(RunCMake_TEST_OPTIONS)
+# -Werror=dev should enable deprecated errors as well
+set(RunCMake_TEST_OPTIONS -Werror=dev)
+run_cmake(Werror_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
set(RunCMake_TEST_OPTIONS -Wdeprecated)
run_cmake(Wdeprecated)
unset(RunCMake_TEST_OPTIONS)
@@ -208,6 +221,14 @@ set(RunCMake_TEST_OPTIONS -Wno-deprecated)
run_cmake(Wno-deprecated)
unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Werror=deprecated)
+run_cmake(Werror_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Wno-error=deprecated)
+run_cmake(Wno-error_deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
# Dev warnings should be on by default
run_cmake(Wdev)
@@ -224,6 +245,7 @@ unset(RunCMake_TEST_OPTIONS)
run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W)
run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-)
+run_cmake_command(W_bad-arg3 ${CMAKE_COMMAND} -Werror=)
set(RunCMake_TEST_OPTIONS --debug-output)
run_cmake(debug-output)
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
new file mode 100644
index 0000000..cc643df
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg3-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: No warning name provided.
+CMake Error: Problem processing arguments. Aborting.
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt
new file mode 100644
index 0000000..6acdc73
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Error at Werror_deprecated.cmake:1 \(message\):
+ Some deprecated warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/Werror_deprecated.cmake b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake
new file mode 100644
index 0000000..3142b42
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_deprecated.cmake
@@ -0,0 +1 @@
+message(DEPRECATION "Some deprecated warning")
diff --git a/Tests/RunCMake/CommandLine/Werror_dev-result.txt b/Tests/RunCMake/CommandLine/Werror_dev-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt
new file mode 100644
index 0000000..590ec96
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Error \(dev\) at Werror_dev.cmake:4 \(include\):
+ include\(\) given empty file name \(ignored\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This error is for project developers. Use -Wno-error=dev to suppress it.
+
+CMake Error \(dev\) at Werror_dev.cmake:7 \(message\):
+ Some author warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This error is for project developers. Use -Wno-error=dev to suppress it.$
diff --git a/Tests/RunCMake/CommandLine/Werror_dev.cmake b/Tests/RunCMake/CommandLine/Werror_dev.cmake
new file mode 100644
index 0000000..05f333a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Werror_dev.cmake
@@ -0,0 +1,7 @@
+# with -Werror=dev this will also cause an (upgraded) AUTHOR_ERROR message,
+# checks that messages issued outside of the message command, by other CMake
+# commands, also are affected by -Werror=dev
+include("")
+
+# message command sets fatal occurred flag, so run it last
+message(AUTHOR_WARNING "Some author warning")
diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt
new file mode 100644
index 0000000..0ed1698
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Warning at Wno-error_deprecated.cmake:2 \(message\):
+ Some deprecated warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake
new file mode 100644
index 0000000..676792a
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_deprecated.cmake
@@ -0,0 +1,2 @@
+# This should still produce a warning when -Wno-error=deprecated is specified
+message(DEPRECATION "Some deprecated warning")
diff --git a/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt
new file mode 100644
index 0000000..dd22d55
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_dev-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning \(dev\) at Wno-error_dev.cmake:2 \(message\):
+ Some author warning
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning \(dev\) at Wno-error_dev.cmake:6 \(include\):
+ include\(\) given empty file name \(ignored\).
+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/CommandLine/Wno-error_dev.cmake b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake
new file mode 100644
index 0000000..b700c19
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-error_dev.cmake
@@ -0,0 +1,7 @@
+# This should still produce a warning when -Wno-error=dev is specified
+message(AUTHOR_WARNING "Some author warning")
+
+# with -Wno-error=dev this will also cause an AUTHOR_WARNING message, checks
+# that messages issued outside of the message command, by other CMake commands,
+# also are affected by -Wno-error=dev
+include("")