diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-16 17:52:54 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2010-09-16 17:52:54 (GMT) |
commit | f7438ca7ac62007aec39d0e9134d556607ccbff3 (patch) | |
tree | bc64afebef541cf559f890c44598f83143b32d1a | |
parent | 995cfb0e2a4d2787371f87568bc943e6ad34d55c (diff) | |
download | CMake-f7438ca7ac62007aec39d0e9134d556607ccbff3.zip CMake-f7438ca7ac62007aec39d0e9134d556607ccbff3.tar.gz CMake-f7438ca7ac62007aec39d0e9134d556607ccbff3.tar.bz2 |
Add test for unused detection via setting it
-rw-r--r-- | Tests/CMakeLists.txt | 15 | ||||
-rw-r--r-- | Tests/VariableUnusedViaSet/CMakeLists.txt | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index be0c27c..739dcdf 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1074,6 +1074,21 @@ ${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(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaSet" + "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-noclean + --build-project WarnUnusedUnusedViaSet + --build-options "--warn-unused-vars") + SET_TESTS_PROPERTIES(WarnUnusedUnusedViaSet PROPERTIES + PASS_REGULAR_EXPRESSION "warning: \\(changing definition\\) unused variable 'UNUSED_VARIABLE'") + SET_TESTS_PROPERTIES(WarnUnusedUnusedViaSet PROPERTIES + FAIL_REGULAR_EXPRESSION "warning: \\(unsetting\\) unused variable 'UNUSED_VARIABLE'") + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet") + ADD_TEST(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaUnset" diff --git a/Tests/VariableUnusedViaSet/CMakeLists.txt b/Tests/VariableUnusedViaSet/CMakeLists.txt new file mode 100644 index 0000000..0123ab2 --- /dev/null +++ b/Tests/VariableUnusedViaSet/CMakeLists.txt @@ -0,0 +1,4 @@ +set(UNUSED_VARIABLE) +# Warning should occur here +set(UNUSED_VARIABLE "Usage") +message(STATUS "${UNUSED_VARIABLE}") |