summaryrefslogtreecommitdiff
path: root/Tests/CMakeTests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r--Tests/CMakeTests/CMakeLists.txt1
-rw-r--r--Tests/CMakeTests/PushCheckStateTest.cmake.in30
2 files changed, 31 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 5cb50c93af..fc1426e8ed 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -28,6 +28,7 @@ AddCMakeTest(Math "")
AddCMakeTest(CMakeMinimumRequired "")
AddCMakeTest(CompilerIdVendor "")
AddCMakeTest(ProcessorCount "")
+AddCMakeTest(PushCheckState "")
AddCMakeTest(FileDownload "")
set_property(TEST CMake.FileDownload PROPERTY
diff --git a/Tests/CMakeTests/PushCheckStateTest.cmake.in b/Tests/CMakeTests/PushCheckStateTest.cmake.in
new file mode 100644
index 0000000000..e707b9a927
--- /dev/null
+++ b/Tests/CMakeTests/PushCheckStateTest.cmake.in
@@ -0,0 +1,30 @@
+include(CMakePushCheckState)
+
+set(CMAKE_REQUIRED_DEFINITIONS defs1 )
+
+cmake_push_check_state()
+
+set(CMAKE_REQUIRED_DEFINITIONS defs2)
+
+cmake_push_check_state()
+
+set(CMAKE_REQUIRED_DEFINITIONS defs3)
+
+cmake_pop_check_state()
+
+if (NOT "${CMAKE_REQUIRED_DEFINITIONS}" STREQUAL "defs2")
+ set(fatal TRUE)
+ message("ERROR: "CMAKE_REQUIRED_DEFINITIONS is \"${CMAKE_REQUIRED_DEFINITIONS}\" (expected \"defs2\")" )
+endif()
+
+cmake_pop_check_state()
+
+if (NOT "${CMAKE_REQUIRED_DEFINITIONS}" STREQUAL "defs1")
+ set(fatal TRUE)
+ message("ERROR: "CMAKE_REQUIRED_DEFINITIONS is \"${CMAKE_REQUIRED_DEFINITIONS}\" (expected \"defs1\")" )
+endif()
+
+
+if(fatal)
+ message(FATAL_ERROR "cmake_push_check_state() test failed")
+endif()