2 # Check if the system is big endian or little endian
4 # VARIABLE - variable to store the result to
7 MACRO(TEST_BIG_ENDIAN VARIABLE)
8 IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
9 TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
11 ${CMAKE_ROOT}/Modules/TestBigEndian.c
12 OUTPUT_VARIABLE OUTPUT)
13 MESSAGE(STATUS "Check if the system is big endian")
15 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
16 "Determining the endianes of the system passed. The system is ")
18 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
20 MESSAGE(STATUS "Check if the system is big endian - big endian")
22 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
24 MESSAGE(STATUS "Check if the system is big endian - little endian")
26 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
27 "Test produced following output:\n${OUTPUT}\n\n")
28 ELSE(HAVE_${VARIABLE})
29 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log
30 "Determining the endianes of the system failed with the following output:\n${OUTPUT}\n\n")
31 MESSAGE("Check if the system is big endian - failed")
32 ENDIF(HAVE_${VARIABLE})
33 ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
34 ENDMACRO(TEST_BIG_ENDIAN)