diff options
author | Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> | 2016-03-31 14:58:33 (GMT) |
---|---|---|
committer | Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com> | 2016-03-31 14:58:33 (GMT) |
commit | a3468b78f21d6f3520a351fde6db6dd9153df948 (patch) | |
tree | 3578e45348504954727adf952472cc58d39bddc0 /Tests/CMakeTests | |
parent | 85b2bb6cb48a431c3f941227302b42bd7588edfb (diff) | |
download | CMake-a3468b78f21d6f3520a351fde6db6dd9153df948.zip CMake-a3468b78f21d6f3520a351fde6db6dd9153df948.tar.gz CMake-a3468b78f21d6f3520a351fde6db6dd9153df948.tar.bz2 |
PushCheckStateTest: Test all variables managed by the module
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r-- | Tests/CMakeTests/PushCheckStateTest.cmake.in | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/Tests/CMakeTests/PushCheckStateTest.cmake.in b/Tests/CMakeTests/PushCheckStateTest.cmake.in index 212877d..195881c 100644 --- a/Tests/CMakeTests/PushCheckStateTest.cmake.in +++ b/Tests/CMakeTests/PushCheckStateTest.cmake.in @@ -1,29 +1,63 @@ include(CMakePushCheckState) +set(CMAKE_REQUIRED_INCLUDES dir1) set(CMAKE_REQUIRED_DEFINITIONS defs1 ) +set(CMAKE_REQUIRED_LIBRARIES lib1) +set(CMAKE_REQUIRED_FLAGS flag1) +set(CMAKE_REQUIRED_QUIET 1) cmake_push_check_state() +set(CMAKE_REQUIRED_INCLUDES dir2) set(CMAKE_REQUIRED_DEFINITIONS defs2) +set(CMAKE_REQUIRED_LIBRARIES lib2) +set(CMAKE_REQUIRED_FLAGS flag2) +set(CMAKE_REQUIRED_QUIET 2) cmake_push_check_state() set(CMAKE_REQUIRED_DEFINITIONS defs3) +set(CMAKE_REQUIRED_INCLUDES dir3) +set(CMAKE_REQUIRED_DEFINITIONS defs3) +set(CMAKE_REQUIRED_LIBRARIES lib3) +set(CMAKE_REQUIRED_FLAGS flag3) +set(CMAKE_REQUIRED_QUIET 3) 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() +foreach(pair IN ITEMS + REQUIRED_INCLUDES|dir2 + REQUIRED_DEFINITIONS|defs2 + REQUIRED_LIBRARIES|lib2 + REQUIRED_FLAGS|flag2 + REQUIRED_QUIET|2 + ) + string(REPLACE "|" ";" pair "${pair}") + list(GET pair 0 var) + list(GET pair 1 expected) + if (NOT "${CMAKE_${var}}" STREQUAL "${expected}") + set(fatal TRUE) + message("ERROR: CMAKE_${var} is \"${CMAKE_${var}}\" (expected \"${expected}\")" ) + endif() +endforeach() 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() - +foreach(pair IN ITEMS + REQUIRED_INCLUDES|dir1 + REQUIRED_DEFINITIONS|defs1 + REQUIRED_LIBRARIES|lib1 + REQUIRED_FLAGS|flag1 + REQUIRED_QUIET|1 + ) + string(REPLACE "|" ";" pair "${pair}") + list(GET pair 0 var) + list(GET pair 1 expected) + if (NOT "${CMAKE_${var}}" STREQUAL "${expected}") + set(fatal TRUE) + message("ERROR: CMAKE_${var} is \"${CMAKE_${var}}\" (expected \"${expected}\")" ) + endif() +endforeach() if(fatal) message(FATAL_ERROR "cmake_push_check_state() test failed") |