File: FindHDF4.cmake

package info (click to toggle)
nexus 4.4.3-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,876 kB
  • sloc: cpp: 34,928; ansic: 17,317; f90: 2,326; xml: 2,071; java: 1,953; fortran: 1,529; python: 766; makefile: 532; sh: 460; tcl: 173; lisp: 169
file content (97 lines) | stat: -rw-r--r-- 3,786 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
## Process this file with cmake
#=============================================================================
#  NeXus - Neutron & X-ray Common Data Format
#
#  CMakeLists for building the NeXus library and applications.
#
#  Copyright (C) 2011 Stephen Rankin
#
#  This library is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by the
#  Free Software Foundation; either version 2 of the License, or (at your
#  option) any later version.
#
#  This library is distributed in the hope that it will be useful, but WITHOUT
#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
#  for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with this library; if not, write to the Free Software Foundation,
#  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#  For further information, see <http://www.nexusformat.org>
#
#
#=============================================================================


#------------------------------------------------------------------------------
# find the runtime binaries of the HDF4 library
#------------------------------------------------------------------------------
find_library(HDF4_DF_LIBRARY NAMES df hdf
             HINTS ENV HDF4_ROOT 
             PATH_SUFFIXES hdf)
             

if(HDF4_DF_LIBRARY MATCHES HDF4_DF_LIBRARY-NOTFOUND)
    message(FATAL_ERROR "Could not find HDF4 DF library!")
else()
    get_filename_component(HDF4_LIBRARY_DIRS ${HDF4_DF_LIBRARY} PATH)
    message(STATUS "Found HDF4 DF library: ${HDF4_DF_LIBRARY}")
    message(STATUS "HDF4 libary path: ${HDF4_LIBRARY_DIRS}")
endif()

find_library(HDF4_MFHDF_LIBRARY NAMES mfhdf 
             HINTS ENV HDF4_ROOT
             PATH_SUFFIXES hdf)

if(HDF4_MFHDF_LIBRARY MATCHES HDF4_MFHDF_LIBRARY-NOTFOUND)
    message(FATAL_ERROR "Could not find HDF5 MFHDF library!")
else()
    message(STATUS "Found HDF4 MFHDF library: ${HDF4_MFHDF_LIBRARY}")
endif()


#------------------------------------------------------------------------------
# find the HDF4 header file
#------------------------------------------------------------------------------
find_path(HDF4_INCLUDE_DIRS mfhdf.h 
          HINTS ENV HDF4_ROOT 
          PATH_SUFFIXES hdf)
          
if(HDF4_INCLUDE_DIRS MATCHES HDF4_INCLUDE_DIRS-NOTFOUND)
    message(FATAL_ERROR "Could not find HDF4 header files")
else()
    message(STATUS "Found HDF4 header files in: ${HDF4_INCLUDE_DIRS}")
endif()

#------------------------------------------------------------------------------
# search for additional packages required to link against HDF4
#------------------------------------------------------------------------------
find_package(JPEG REQUIRED)

#------------------------------------------------------------------------------
# add libraries to the link list for NAPI
#------------------------------------------------------------------------------
get_filename_component(LIB_EXT ${HDF4_DF_LIBRARY} EXT)
if(LIB_EXT MATCHES .a)
    message(STATUS "HDF4 DF library is static")
    list(APPEND NAPI_LINK_LIBS "-Wl,-whole-archive" ${HDF4_DF_LIBRARY} "-Wl,-no-whole-archive")
else()
    list(APPEND NAPI_LINK_LIBS ${HDF4_DF_LIBRARY})
endif()


get_filename_component(LIB_EXT ${HDF4_MFHDF_LIBRARY} EXT)
if(LIB_EXT MATCHES .a)
    message(STATUS "HDF4 MFHDF library is static")
    list(APPEND NAPI_LINK_LIBS "-Wl,-whole-archive" ${HDF4_MFHDF_LIBRARY} "-Wl,-no-whole-archive")
else()
    list(APPEND NAPI_LINK_LIBS ${HDF4_MFHDF_LIBRARY})
endif()

list(APPEND NAPI_LINK_LIBS jpeg)

include_directories ( SYSTEM ${HDF4_INCLUDE_DIRS} )
link_directories(${HDF4_LIBRARY_DIRS})