diff options
Diffstat (limited to 'Modules/TestBigEndian.cmake')
-rw-r--r-- | Modules/TestBigEndian.cmake | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake index 417e754..3f6d719 100644 --- a/Modules/TestBigEndian.cmake +++ b/Modules/TestBigEndian.cmake @@ -5,12 +5,30 @@ # MACRO(TEST_BIG_ENDIAN VARIABLE) - TRY_RUN(${VARIABLE} HAVE_${VARIABLE} - ${CMAKE_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestBigEndian.c - OUTPUT_VARIABLE OUTPUT) - IF(NOT HAVE_${VARIABLE}) - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log - "Determining the endianes of the system failed with the following output:\n${OUTPUT}\n\n") - ENDIF(NOT HAVE_${VARIABLE}) + IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + TRY_RUN(${VARIABLE} HAVE_${VARIABLE} + ${CMAKE_BINARY_DIR} + ${CMAKE_ROOT}/Modules/TestBigEndian.c + OUTPUT_VARIABLE OUTPUT) + MESSAGE(STATUS "Check if the system is big endian") + IF(HAVE_${VARIABLE}) + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + "Determining the endianes of the system passed. The system is ") + IF(${VARIABLE}) + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + "big endian") + MESSAGE(STATUS "Check if the system is big endian - big endian") + ELSE(${VARIABLE}) + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + "little endian") + MESSAGE(STATUS "Check if the system is big endian - little endian") + ENDIF(${VARIABLE}) + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + "Test produced following output:\n${OUTPUT}\n\n") + ELSE(HAVE_${VARIABLE}) + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + "Determining the endianes of the system failed with the following output:\n${OUTPUT}\n\n") + MESSAGE("Check if the system is big endian - failed") + ENDIF(HAVE_${VARIABLE}) + ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") ENDMACRO(TEST_BIG_ENDIAN) |