summaryrefslogtreecommitdiffstats
path: root/Modules/TestBigEndian.cmake
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 17:47:32 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-13 18:19:16 (GMT)
commit77543bde41b0e52c3959016698b529835945d62d (patch)
treeff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Modules/TestBigEndian.cmake
parent7bbaa4283de26864b2e55e819db0884771585467 (diff)
downloadCMake-77543bde41b0e52c3959016698b529835945d62d.zip
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.gz
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.bz2
Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
Diffstat (limited to 'Modules/TestBigEndian.cmake')
-rw-r--r--Modules/TestBigEndian.cmake120
1 files changed, 60 insertions, 60 deletions
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index bca7979..d162f13 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -17,96 +17,96 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-MACRO(TEST_BIG_ENDIAN VARIABLE)
- IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
- MESSAGE(STATUS "Check if the system is big endian")
- MESSAGE(STATUS "Searching 16 bit integer")
+macro(TEST_BIG_ENDIAN VARIABLE)
+ if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+ message(STATUS "Check if the system is big endian")
+ message(STATUS "Searching 16 bit integer")
- INCLUDE(CheckTypeSize)
+ include(CheckTypeSize)
CHECK_TYPE_SIZE("unsigned short" CMAKE_SIZEOF_UNSIGNED_SHORT)
- IF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
- MESSAGE(STATUS "Using unsigned short")
- SET(CMAKE_16BIT_TYPE "unsigned short")
- ELSE(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+ if(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+ message(STATUS "Using unsigned short")
+ set(CMAKE_16BIT_TYPE "unsigned short")
+ else(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
CHECK_TYPE_SIZE("unsigned int" CMAKE_SIZEOF_UNSIGNED_INT)
- IF(CMAKE_SIZEOF_UNSIGNED_INT)
- MESSAGE(STATUS "Using unsigned int")
- SET(CMAKE_16BIT_TYPE "unsigned int")
+ if(CMAKE_SIZEOF_UNSIGNED_INT)
+ message(STATUS "Using unsigned int")
+ set(CMAKE_16BIT_TYPE "unsigned int")
- ELSE(CMAKE_SIZEOF_UNSIGNED_INT)
+ else(CMAKE_SIZEOF_UNSIGNED_INT)
CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_UNSIGNED_LONG)
- IF(CMAKE_SIZEOF_UNSIGNED_LONG)
- MESSAGE(STATUS "Using unsigned long")
- SET(CMAKE_16BIT_TYPE "unsigned long")
- ELSE(CMAKE_SIZEOF_UNSIGNED_LONG)
- MESSAGE(FATAL_ERROR "no suitable type found")
- ENDIF(CMAKE_SIZEOF_UNSIGNED_LONG)
+ if(CMAKE_SIZEOF_UNSIGNED_LONG)
+ message(STATUS "Using unsigned long")
+ set(CMAKE_16BIT_TYPE "unsigned long")
+ else(CMAKE_SIZEOF_UNSIGNED_LONG)
+ message(FATAL_ERROR "no suitable type found")
+ endif(CMAKE_SIZEOF_UNSIGNED_LONG)
- ENDIF(CMAKE_SIZEOF_UNSIGNED_INT)
+ endif(CMAKE_SIZEOF_UNSIGNED_INT)
- ENDIF(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
+ endif(CMAKE_SIZEOF_UNSIGNED_SHORT EQUAL 2)
- CONFIGURE_FILE("${CMAKE_ROOT}/Modules/TestEndianess.c.in"
+ configure_file("${CMAKE_ROOT}/Modules/TestEndianess.c.in"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
IMMEDIATE @ONLY)
- FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
+ file(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
TEST_ENDIANESS_FILE_CONTENT)
- TRY_COMPILE(HAVE_${VARIABLE}
+ try_compile(HAVE_${VARIABLE}
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/TestEndianess.c"
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" )
- IF(HAVE_${VARIABLE})
+ if(HAVE_${VARIABLE})
- FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
+ file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
CMAKE_TEST_ENDIANESS_STRINGS_LE LIMIT_COUNT 1 REGEX "THIS IS LITTLE ENDIAN")
- FILE(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
+ file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
CMAKE_TEST_ENDIANESS_STRINGS_BE LIMIT_COUNT 1 REGEX "THIS IS BIG ENDIAN")
# on mac, if there are universal binaries built both will be true
# return the result depending on the machine on which cmake runs
- IF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
- IF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
- SET(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE)
- SET(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE)
- ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
- SET(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE)
- SET(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE)
- ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
- MESSAGE(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
- ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
-
- IF(CMAKE_TEST_ENDIANESS_STRINGS_LE)
- SET(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
- MESSAGE(STATUS "Check if the system is big endian - little endian")
- ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_LE)
-
- IF(CMAKE_TEST_ENDIANESS_STRINGS_BE)
- SET(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
- MESSAGE(STATUS "Check if the system is big endian - big endian")
- ENDIF(CMAKE_TEST_ENDIANESS_STRINGS_BE)
-
- IF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
- MESSAGE(SEND_ERROR "TEST_BIG_ENDIAN found no result!")
- ENDIF(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
-
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ if(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ set(CMAKE_TEST_ENDIANESS_STRINGS_BE TRUE)
+ set(CMAKE_TEST_ENDIANESS_STRINGS_LE FALSE)
+ else(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ set(CMAKE_TEST_ENDIANESS_STRINGS_BE FALSE)
+ set(CMAKE_TEST_ENDIANESS_STRINGS_LE TRUE)
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+ message(STATUS "TEST_BIG_ENDIAN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
+ endif(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ if(CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ set(${VARIABLE} 0 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
+ message(STATUS "Check if the system is big endian - little endian")
+ endif(CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ if(CMAKE_TEST_ENDIANESS_STRINGS_BE)
+ set(${VARIABLE} 1 CACHE INTERNAL "Result of TEST_BIG_ENDIAN" FORCE)
+ message(STATUS "Check if the system is big endian - big endian")
+ endif(CMAKE_TEST_ENDIANESS_STRINGS_BE)
+
+ if(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
+ message(SEND_ERROR "TEST_BIG_ENDIAN found no result!")
+ endif(NOT CMAKE_TEST_ENDIANESS_STRINGS_BE AND NOT CMAKE_TEST_ENDIANESS_STRINGS_LE)
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the system is big endian passed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n")
- ELSE(HAVE_${VARIABLE})
- MESSAGE(STATUS "Check if the system is big endian - failed")
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ else(HAVE_${VARIABLE})
+ message(STATUS "Check if the system is big endian - failed")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the system is big endian failed with the following output:\n${OUTPUT}\nTestEndianess.c:\n${TEST_ENDIANESS_FILE_CONTENT}\n\n")
- SET(${VARIABLE})
- ENDIF(HAVE_${VARIABLE})
- ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
-ENDMACRO(TEST_BIG_ENDIAN)
+ set(${VARIABLE})
+ endif(HAVE_${VARIABLE})
+ endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+endmacro(TEST_BIG_ENDIAN)