summaryrefslogtreecommitdiff
path: root/Tests/CMakeTests/PushCheckStateTest.cmake.in
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeTests/PushCheckStateTest.cmake.in')
-rw-r--r--Tests/CMakeTests/PushCheckStateTest.cmake.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/CMakeTests/PushCheckStateTest.cmake.in b/Tests/CMakeTests/PushCheckStateTest.cmake.in
new file mode 100644
index 000000000..e707b9a92
--- /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()