summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ABI/C.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-11 15:39:14 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-11 15:39:14 (GMT)
commit3765a415dfd4c521b4e656412503cbe1051a4c0b (patch)
treea29565d1f4efd97306d2f23684b04e9a659bb2fc /Tests/RunCMake/ABI/C.cmake
parentff4d1d44f217bcbd90ba97f0fc41806cccb34e57 (diff)
parentadc6a4c5402658b8218a591639b652604893b919 (diff)
downloadCMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.zip
CMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.tar.gz
CMake-3765a415dfd4c521b4e656412503cbe1051a4c0b.tar.bz2
Merge branch 'master' into doc-3_19_release-fixes
Diffstat (limited to 'Tests/RunCMake/ABI/C.cmake')
-rw-r--r--Tests/RunCMake/ABI/C.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/ABI/C.cmake b/Tests/RunCMake/ABI/C.cmake
new file mode 100644
index 0000000..92f5da4
--- /dev/null
+++ b/Tests/RunCMake/ABI/C.cmake
@@ -0,0 +1,22 @@
+enable_language(C)
+if(NOT CMAKE_C_BYTE_ORDER MATCHES "^(BIG_ENDIAN|LITTLE_ENDIAN)$")
+ if(CMAKE_OSX_ARCHITECTURES MATCHES ";ppc|ppc;")
+ return()
+ endif()
+ message(FATAL_ERROR "CMAKE_C_BYTE_ORDER has unexpected value '${CMAKE_C_BYTE_ORDER}'")
+endif()
+
+include(TestBigEndian)
+test_big_endian(IS_BIG_ENDIAN)
+if(IS_BIG_ENDIAN AND NOT CMAKE_C_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_C_BYTE_ORDER}")
+unset(CMAKE_C_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()