CheckFor64BitStreams.cmake 1.78 KB
Newer Older
Andy Cedilnik's avatar
Andy Cedilnik committed
1
2
3
4
5
6
7
8
#
# Check if the system supports 64 bit streams
#
# CHECK_FOR_64BIT_STREAMS - macro which checks the existence of 64 bit streams
# VARIABLE - variable to return result
#

MACRO(CHECK_FOR_64BIT_STREAMS VARIABLE)
9
  IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
Andy Cedilnik's avatar
Andy Cedilnik committed
10
11
    SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS ${CMAKE_REQUIRED_FLAGS})
    IF(CMAKE_NO_ANSI_STREAM_HEADERS)
Brad King's avatar
Brad King committed
12
      SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS
Andy Cedilnik's avatar
Andy Cedilnik committed
13
14
15
16
17
18
19
20
21
22
23
24
25
        "${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DNO_ANSI")
    ENDIF(CMAKE_NO_ANSI_STREAM_HEADERS)
    IF(SIZEOF_LONG_LONG)
      SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS 
        "${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DSIZEOF_LONG_LONG")
    ENDIF(SIZEOF_LONG_LONG)
    IF(SIZEOF___INT64)
      SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS 
        "${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS} -DSIZEOF___INT64")
    ENDIF(SIZEOF___INT64)
    MESSAGE(STATUS "Check if system supports 64 bit streams")
    TRY_COMPILE(${VARIABLE}
               ${CMAKE_BINARY_DIR}
26
               ${xdmf2_SOURCE_DIR}/CMake/CheckFor64BitStreams.cxx
Andy Cedilnik's avatar
Andy Cedilnik committed
27
28
29
30
31
               CMAKE_FLAGS 
               -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS}
               OUTPUT_VARIABLE OUTPUT)
    IF(${VARIABLE})
      MESSAGE(STATUS "Check if system supports 64 bit streams - yes")
32
      SET(${VARIABLE} 1 CACHE INTERNAL "Whether streams support 64-bit types")
Andy Cedilnik's avatar
Andy Cedilnik committed
33
34
    ELSE(${VARIABLE})
      MESSAGE(STATUS "Check if system supports 64 bit streams - no")
35
      SET(${VARIABLE} "" CACHE INTERNAL "Whether streams support 64-bit types")
Ken Martin's avatar
Ken Martin committed
36
      WRITE_FILE(${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log 
Andy Cedilnik's avatar
Andy Cedilnik committed
37
38
39
40
        "Determining if the system supports 64 bit streams "
        "failed with the following output:\n"
        "${OUTPUT}\n" APPEND)
    ENDIF(${VARIABLE})
41
  ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$")
Andy Cedilnik's avatar
Andy Cedilnik committed
42
ENDMACRO(CHECK_FOR_64BIT_STREAMS)