FindH5Hut.cmake 1.5 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12
#
# Find H5hut includes and library
#
# H5Hut
# It can be found at:
#     http://amas.web.psi.ch/tools/H5hut/index.html
#
# H5Hut_INCLUDE_DIR - where to find H5hut.h
# H5Hut_LIBRARY     - qualified libraries to link against.
# H5Hut_FOUND       - do not attempt to use if "no" or undefined.

FIND_PATH(H5Hut_INCLUDE_DIR H5hut.h
13
    HINTS $ENV{H5HUT_INCLUDE_PATH} $ENV{H5HUT_INCLUDE_DIR} $ENV{H5HUT}/include $ENV{H5HUT_PREFIX}/include $ENV{H5HUT_DIR}/include $ENV{H5hut}/include
gsell's avatar
gsell committed
14
    PATHS ENV C_INCLUDE_PATH
gsell's avatar
gsell committed
15 16 17
)

FIND_LIBRARY(H5Hut_LIBRARY H5hut
18
    HINTS $ENV{H5HUT_LIBRARY_PATH} $ENV{H5HUT_LIBRARY_DIR} $ENV{H5HUT}/lib $ENV{H5HUT_PREFIX}/lib $ENV{H5HUT_DIR}/lib $ENV{H5hut}/lib
19
    PATHS ENV LIBRARY_PATH
gsell's avatar
gsell committed
20 21 22 23 24 25 26
)

IF(H5Hut_INCLUDE_DIR AND H5Hut_LIBRARY)
    SET( H5Hut_FOUND "YES" )
ENDIF(H5Hut_INCLUDE_DIR AND H5Hut_LIBRARY)

IF (H5Hut_FOUND)
gsell's avatar
gsell committed
27 28 29 30
    IF (NOT H5Hut_FIND_QUIETLY)
        MESSAGE(STATUS "Found H5Hut libraries: ${H5Hut_LIBRARY}")
        MESSAGE(STATUS "Found H5Hut include dir: ${H5Hut_INCLUDE_DIR}")
    ENDIF (NOT H5Hut_FIND_QUIETLY)
gsell's avatar
gsell committed
31
ELSE (H5Hut_FOUND)
gsell's avatar
gsell committed
32 33 34
    IF (H5Hut_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find H5Hut!")
    ENDIF (H5Hut_FIND_REQUIRED)
gsell's avatar
gsell committed
35
ENDIF (H5Hut_FOUND)
gsell's avatar
gsell committed
36 37

include (CheckIncludeFile)
38
SET (CMAKE_REQUIRED_INCLUDES ${H5Hut_INCLUDE_DIR})
39
CHECK_INCLUDE_FILE (H5_file_attribs.h HAVE_API2_FUNCTIONS "-I${H5Hut_INCLUDE_DIR} -DPARALLEL_IO")
gsell's avatar
gsell committed
40 41

IF (HAVE_API2_FUNCTIONS)
gsell's avatar
gsell committed
42
    MESSAGE (STATUS "H5hut version is OK")
gsell's avatar
gsell committed
43
ELSE (HAVE_API2_FUNCTIONS)
gsell's avatar
gsell committed
44
    MESSAGE (ERROR "H5hut >= 2 required")
gsell's avatar
gsell committed
45
ENDIF (HAVE_API2_FUNCTIONS)