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("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
Andy Cedilnik's avatar
Andy Cedilnik committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS ${CMAKE_REQUIRED_FLAGS})
    IF(CMAKE_NO_ANSI_STREAM_HEADERS)
      SET(MACRO_CHECK_FOR_64BIT_STREAMS_FLAGS 
        "${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}
               ${Xdmf_SOURCE_DIR}/CMake/CheckFor64BitStreams.cxx
               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")
      SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
    ELSE(${VARIABLE})
      MESSAGE(STATUS "Check if system supports 64 bit streams - no")
      SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
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("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
Andy Cedilnik's avatar
Andy Cedilnik committed
42
ENDMACRO(CHECK_FOR_64BIT_STREAMS)