diff options
author | Brad King <brad.king@kitware.com> | 2021-05-25 14:02:56 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-05-25 14:03:03 (GMT) |
commit | bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06 (patch) | |
tree | 8f1124bf7f5904c1b3c83eb08905b417aa0a5809 /Tests/RunCMake/CMP0126/CMP0126-OLD.cmake | |
parent | 0c16774fecb8a9ef989f6c0a6705c080ee55d720 (diff) | |
parent | d96eb5528276a19d79116d842389f3ea165ef21b (diff) | |
download | CMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.zip CMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.tar.gz CMake-bf2717e436ff2fceaaaf3a9e032d5f10c7dc8d06.tar.bz2 |
Merge topic 'set-cache-keep-normal-variable'
d96eb55282 set(CACHE): do not remove normal variable
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !6146
Diffstat (limited to 'Tests/RunCMake/CMP0126/CMP0126-OLD.cmake')
-rw-r--r-- | Tests/RunCMake/CMP0126/CMP0126-OLD.cmake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake b/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake new file mode 100644 index 0000000..22a5037 --- /dev/null +++ b/Tests/RunCMake/CMP0126/CMP0126-OLD.cmake @@ -0,0 +1,25 @@ + +# enforce policy CMP0125 to ensure predictable result of find_* commands +cmake_policy(SET CMP0125 NEW) + +cmake_policy(SET CMP0126 OLD) + +set(VAR 1) +set(VAR 2 CACHE STRING "") + +if (VAR EQUAL 1) + message(FATAL_ERROR "normal variable still exist.") +endif() + + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/file.txt" "") +set(VAR file.txt) +set(VAR "" CACHE STRING "" FORCE) +set_property(CACHE VAR PROPERTY TYPE UNINITIALIZED) + +find_file(VAR NAMES file.txt PATHS "${CMAKE_CURRENT_BINARY_DIR}") + +unset(VAR CACHE) +if (DEFINED VAR) + message(FATAL_ERROR "find_file: normal variable still exist.") +endif() |