summaryrefslogtreecommitdiffstats
path: root/Modules/TestBigEndian.cmake
blob: 2be59e34d4b8cebcfeb55ccd8248f97cb59cf274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# Check if the system is big endian or little endian
#
# VARIABLE - variable to store the result to
#

MACRO(TEST_BIG_ENDIAN VARIABLE)
  TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
          ${PROJECT_BINARY_DIR}
          ${CMAKE_ROOT}/Modules/TestBigEndian.c
          OUTPUT_VARIABLE OUTPUT)
  IF(NOT HAVE_${VARIABLE})
    WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log 
      "Determining the endianes of the system failed with the following output:\n${OUTPUT}\n"
      APPEND)
  ENDIF(NOT HAVE_${VARIABLE})
ENDMACRO(TEST_BIG_ENDIAN)