summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Configure/RemoveCache.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-17 15:29:55 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-17 15:29:58 (GMT)
commit25b6e7b710d7739cca44ed19bf45a190e72a6b82 (patch)
tree9699bdd712c12a0828a80ab6a01dfbb471c2ca53 /Tests/RunCMake/Configure/RemoveCache.cmake
parent0e9634d2c90fd748774f9238219cb1661550f233 (diff)
downloadCMake-25b6e7b710d7739cca44ed19bf45a190e72a6b82.zip
CMake-25b6e7b710d7739cca44ed19bf45a190e72a6b82.tar.gz
CMake-25b6e7b710d7739cca44ed19bf45a190e72a6b82.tar.bz2
Tolerate removed/replaced CMakeCache.txt with old CMakeFiles/
Users or scripts commonly remove or replace `CMakeCache.txt` without also removing `CMakeFiles/`. In this case the information saved in the cache from platform information initialization is missing, so we need to re-initialize it. In such a case, remove the platform information directory so that re-initialization will occur and restore needed information to the cache. Closes: #14820
Diffstat (limited to 'Tests/RunCMake/Configure/RemoveCache.cmake')
-rw-r--r--Tests/RunCMake/Configure/RemoveCache.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/Configure/RemoveCache.cmake b/Tests/RunCMake/Configure/RemoveCache.cmake
new file mode 100644
index 0000000..304918f
--- /dev/null
+++ b/Tests/RunCMake/Configure/RemoveCache.cmake
@@ -0,0 +1,17 @@
+enable_language(C)
+
+set(vars
+ CMAKE_EXECUTABLE_FORMAT
+ )
+
+if(CMAKE_HOST_UNIX)
+ list(APPEND vars
+ CMAKE_UNAME
+ )
+endif()
+
+foreach(v IN LISTS vars)
+ if(NOT DEFINED ${v})
+ message(SEND_ERROR "Variable '${v}' is not set!")
+ endif()
+endforeach()