2011-07-08 00:07:16 +04:00
|
|
|
include(CMakePushCheckState)
|
|
|
|
|
2016-03-31 18:11:32 +03:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES file1)
|
2016-03-31 17:58:33 +03:00
|
|
|
set(CMAKE_REQUIRED_INCLUDES dir1)
|
2011-07-08 00:07:16 +04:00
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS defs1 )
|
2016-03-31 17:58:33 +03:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES lib1)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS flag1)
|
|
|
|
set(CMAKE_REQUIRED_QUIET 1)
|
2011-07-08 00:07:16 +04:00
|
|
|
|
|
|
|
cmake_push_check_state()
|
|
|
|
|
2016-03-31 18:11:32 +03:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES file2)
|
2016-03-31 17:58:33 +03:00
|
|
|
set(CMAKE_REQUIRED_INCLUDES dir2)
|
2011-07-08 00:07:16 +04:00
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS defs2)
|
2016-03-31 17:58:33 +03:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES lib2)
|
|
|
|
set(CMAKE_REQUIRED_FLAGS flag2)
|
|
|
|
set(CMAKE_REQUIRED_QUIET 2)
|
2011-07-08 00:07:16 +04:00
|
|
|
|
|
|
|
cmake_push_check_state()
|
|
|
|
|
2016-03-31 18:11:32 +03:00
|
|
|
set(CMAKE_EXTRA_INCLUDE_FILES file3)
|
2011-07-08 00:07:16 +04:00
|
|
|
set(CMAKE_REQUIRED_DEFINITIONS defs3)
|
2016-03-31 17:58:33 +03:00
|
|
|
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)
|
2011-07-08 00:07:16 +04:00
|
|
|
|
|
|
|
cmake_pop_check_state()
|
|
|
|
|
2016-03-31 17:58:33 +03:00
|
|
|
foreach(pair IN ITEMS
|
2016-03-31 18:11:32 +03:00
|
|
|
EXTRA_INCLUDE_FILES|file2
|
2016-03-31 17:58:33 +03:00
|
|
|
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()
|
2011-07-08 00:07:16 +04:00
|
|
|
|
|
|
|
cmake_pop_check_state()
|
|
|
|
|
2016-03-31 17:58:33 +03:00
|
|
|
foreach(pair IN ITEMS
|
2016-03-31 18:11:32 +03:00
|
|
|
EXTRA_INCLUDE_FILES|file1
|
2016-03-31 17:58:33 +03:00
|
|
|
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()
|
2011-07-08 00:07:16 +04:00
|
|
|
|
|
|
|
if(fatal)
|
|
|
|
message(FATAL_ERROR "cmake_push_check_state() test failed")
|
|
|
|
endif()
|