summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
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/CMakeLists.txt
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/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt28
1 files changed, 17 insertions, 11 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 0b221e8..a91eac7 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1618,17 +1618,23 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
FAIL_REGULAR_EXPRESSION "CMake Warning .*VariableUnusedViaUnset.CMakeLists.txt:5 \\(set\\):")
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
- add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/VariableUsage"
- "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
- ${build_generator_args}
- --build-noclean
- --build-project WarnUnusedCliUnused
- --build-options "-DUNUSED_CLI_VARIABLE=Unused")
- set_tests_properties(WarnUnusedCliUnused PROPERTIES
- PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+ if("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile")
+ # Ninja does not support ADDITIONAL_MAKE_CLEAN_FILES and therefore fails
+ # this test. (See #13371)
+ # Apparently Visual Studio does not support it either. As the MakeClean
+ # test above is only run with the Makefiles generator, only run this
+ # test with the Makefiles generator also.
+ add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused"
+ "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused"
+ ${build_generator_args}
+ --build-project WarnUnusedCliUnused
+ --build-options "-DUNUSED_CLI_VARIABLE=Unused")
+ set_tests_properties(WarnUnusedCliUnused PROPERTIES
+ PASS_REGULAR_EXPRESSION "CMake Warning:.*Manually-specified variables were not used by the project:.* UNUSED_CLI_VARIABLE")
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedCliUnused")
+ endif()
add_test(WarnUnusedCliUsed ${CMAKE_CTEST_COMMAND}
--build-and-test