summaryrefslogtreecommitdiffstats
path: root/Tests/WarnUnusedCliUnused
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-05-16 19:51:45 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-06-04 10:38:56 (GMT)
commit273ecab96d47d6ddba129be6200bc93ba7910b8c (patch)
tree6d447b544de60b90fb1e539e1fe0be719485a37a /Tests/WarnUnusedCliUnused
parent590a41ba0ead92f3989b3c226632c29fac76bf2e (diff)
downloadCMake-273ecab96d47d6ddba129be6200bc93ba7910b8c.zip
CMake-273ecab96d47d6ddba129be6200bc93ba7910b8c.tar.gz
CMake-273ecab96d47d6ddba129be6200bc93ba7910b8c.tar.bz2
CLI: Suppress the unused warning if the key value pair is cached.
It is common to specify a CMAKE_TOOLCHAIN_FILE and get a warning for using it despite it not being used. The WarnUnusedCliUnused test relies on the warning being emitted each time cmake is run on an existing build. That behavior is changed by this patch to warn only on the first invokation of CMake, and not on subsequent invokations (because the variable is in the cache with the same value). For that test, a clean target is added which clears the cache and cause the warning to be emitted each time. As the Ninja generator does not support the feature needed to test this, it is not tested with that generator.
Diffstat (limited to 'Tests/WarnUnusedCliUnused')
-rw-r--r--Tests/WarnUnusedCliUnused/CMakeLists.txt9
-rw-r--r--Tests/WarnUnusedCliUnused/empty.cpp7
2 files changed, 16 insertions, 0 deletions
diff --git a/Tests/WarnUnusedCliUnused/CMakeLists.txt b/Tests/WarnUnusedCliUnused/CMakeLists.txt
new file mode 100644
index 0000000..7ed69bf
--- /dev/null
+++ b/Tests/WarnUnusedCliUnused/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(WarnUnusedCliUnused)
+
+set_directory_properties(PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/CMakeCache.txt"
+)
+
+add_library(dummy empty.cpp)
diff --git a/Tests/WarnUnusedCliUnused/empty.cpp b/Tests/WarnUnusedCliUnused/empty.cpp
new file mode 100644
index 0000000..7279c5e
--- /dev/null
+++ b/Tests/WarnUnusedCliUnused/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty(void)
+{
+ return 0;
+}