You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
742 B
23 lines
742 B
3 years ago
|
enable_language(CXX)
|
||
|
if(NOT CMAKE_CXX_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$")
|
||
|
if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;")
|
||
|
return()
|
||
|
endif()
|
||
|
message(FATAL_ERROR "CMAKE_CXX_BYTE_ORDER has unexpected value '${CMAKE_CXX_BYTE_ORDER}'")
|
||
|
endif()
|
||
|
|
||
|
include(TestBigEndian)
|
||
|
test_big_endian(IS_BIG_ENDIAN)
|
||
|
if(IS_BIG_ENDIAN AND NOT CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN")
|
||
|
message(FATAL_ERROR "test_big_endian result does not match ABI result")
|
||
|
endif()
|
||
|
|
||
|
# Test legacy check.
|
||
|
set(byte_order "${CMAKE_CXX_BYTE_ORDER}")
|
||
|
unset(CMAKE_CXX_BYTE_ORDER)
|
||
|
include(TestBigEndian)
|
||
|
test_big_endian(IS_BIG)
|
||
|
if(IS_BIG AND NOT byte_order STREQUAL "BIG_ENDIAN")
|
||
|
message(FATAL_ERROR "test_big_endian result does not match ABI result")
|
||
|
endif()
|