diff options
author | Brad King <brad.king@kitware.com> | 2018-11-13 15:29:21 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-11-13 15:29:36 (GMT) |
commit | 71e77972c18e1ab905b36782d7b2c2f838957e26 (patch) | |
tree | 3d0f0423191787f1c2db088c504441909f54f2c9 /Tests | |
parent | 5e12fad8704e4797ecda3906f3b558775b70539f (diff) | |
parent | 1222f02e343e804f1fcc8ff09e56dc13ac233d98 (diff) | |
download | CMake-71e77972c18e1ab905b36782d7b2c2f838957e26.zip CMake-71e77972c18e1ab905b36782d7b2c2f838957e26.tar.gz CMake-71e77972c18e1ab905b36782d7b2c2f838957e26.tar.bz2 |
Merge topic 'if_support_checking_if_cache_var_defined'
1222f02e34 If: Support the 'DEFINED CACHE{}' syntax
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2561
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Unset/CMakeLists.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt index 07aa68e..a40367b 100644 --- a/Tests/Unset/CMakeLists.txt +++ b/Tests/Unset/CMakeLists.txt @@ -21,17 +21,26 @@ set(x 43) if(NOT x EQUAL 43) message(FATAL_ERROR "x!=43") endif() +if(DEFINED CACHE{x}) + message(FATAL_ERROR "x shouldn't be found in the cache") +endif() + set(x) if(DEFINED x) message(FATAL_ERROR "x should be undefined now!") endif() + # Cache variable set(BAR "test" CACHE STRING "documentation") if(NOT DEFINED BAR) message(FATAL_ERROR "BAR not defined") endif() +if(NOT DEFINED CACHE{BAR}) + message(FATAL_ERROR "BAR could not be found by CACHE{BAR}") +endif() + # Test interaction of cache entries with variables. set(BAR "test-var") if(NOT "$CACHE{BAR}" STREQUAL "test") |