diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-02 15:33:57 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-02 15:33:57 (GMT) |
commit | 75bda3864ea033f976773df80f22fea2992a165d (patch) | |
tree | b4e333dd1d93af58c03b4ec630fd0f540f53ac51 /Tests | |
parent | 300fc15779330a1b733c9e1a19d24d682a3b4a91 (diff) | |
download | CMake-75bda3864ea033f976773df80f22fea2992a165d.zip CMake-75bda3864ea033f976773df80f22fea2992a165d.tar.gz CMake-75bda3864ea033f976773df80f22fea2992a165d.tar.bz2 |
Add tests for unused command line variables
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/VariableUsage/CMakeLists.txt | 1 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5383bda..6415472 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1074,6 +1074,34 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest") ENDIF(APPLE AND CTEST_TEST_CPACK) + ADD_TEST(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VariableUsage" + "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-noclean + --build-project WarnUnusedCliUnused + --build-options "-DUNUSED_VARIABLE=Unused") + SET_TESTS_PROPERTIES(WarnUnusedCliUnused PROPERTIES + PASS_REGULAR_EXPRESSION "warning: The variable, \"UNUSED_VARIABLE\"") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused") + + ADD_TEST(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VariableUsage" + "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-noclean + --build-project WarnUnusedCliUsed + --build-options "-DUSED_VARIABLE=Usage proven") + SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES + PASS_REGULAR_EXPRESSION "Usage proven") + SET_TESTS_PROPERTIES(WarnUnusedCliUsed PROPERTIES + FAIL_REGULAR_EXPRESSION "warning: The variable, \"USED_VARIABLE\"") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUsed") + # Make sure CTest can handle a test with no newline in output. ADD_TEST(CTest.NoNewline ${CMAKE_CMAKE_COMMAND} -E echo_append "This line has no newline!") diff --git a/Tests/VariableUsage/CMakeLists.txt b/Tests/VariableUsage/CMakeLists.txt new file mode 100644 index 0000000..4da1f56 --- /dev/null +++ b/Tests/VariableUsage/CMakeLists.txt @@ -0,0 +1 @@ +message(STATUS "${USED_VARIABLE}") |