summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeTests/PushCheckStateTest.cmake.in
blob: e707b9a9275cfc30224a6833c2da28a32a65c1e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()