From 88ebaa5e4726643ad472d8fc8f731ede87b44b11 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Aug 2010 10:37:50 -0500 Subject: [svn-r19260] Change Cmake to allow a local zlib header to be used in H5Zdelate module. Corrected use of "SKIP" message in cmake. Corrections to cmake configuration files (for cmake external projects). Community suggested changes. Tested: local linux --- CMakeLists.txt | 137 +++++++++++++++++++----------- MANIFEST | 6 +- config/cmake/FindSZIP.cmake | 6 +- config/cmake/hdf5-config-version.cmake.in | 27 ++++++ config/cmake/hdf5-config.cmake.build.in | 68 ++++++++------- config/cmake/hdf5-config.cmake.install.in | 61 +++++++++---- config/cmake/hdf5_zlib.h.in | 1 - src/CMakeLists.txt | 30 ++++--- src/H5Zdeflate.c | 7 +- 9 files changed, 225 insertions(+), 118 deletions(-) create mode 100644 config/cmake/hdf5-config-version.cmake.in delete mode 100644 config/cmake/hdf5_zlib.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 118b617..15259d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,12 @@ PROJECT (HDF5 C CXX) # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. # +# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR : +# Customize the 'bin', 'lib', and 'include' installation directories. +# +# HDF5_INSTALL_NO_DEVELOPMENT : +# Set to true to skip installation of headers and CMake package files. +# # Consider this example from the ParaView project, it builds its own zlib # library and tells HDF5 to add it as a dependency - this ensures that # any project making use of this build of HDF5 will use the correct zlib @@ -128,6 +134,16 @@ SET (HDF5_F90_SOURCE_DIR ${HDF5_SOURCE_DIR}/fortran) # set default prefix location SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories") +IF (NOT HDF5_INSTALL_BIN_DIR) + SET (HDF5_INSTALL_BIN_DIR bin) +ENDIF (NOT HDF5_INSTALL_BIN_DIR) +IF (NOT HDF5_INSTALL_LIB_DIR) + SET (HDF5_INSTALL_LIB_DIR lib) +ENDIF (NOT HDF5_INSTALL_LIB_DIR) +IF (NOT HDF5_INSTALL_INCLUDE_DIR) + SET (HDF5_INSTALL_INCLUDE_DIR include) +ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR) + #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO #----------------------------------------------------------------------------- @@ -180,7 +196,7 @@ ELSE (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) ENDIF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) -ENDIF(NOT HDF5_EXTERNALLY_CONFIGURED) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use @@ -493,11 +509,11 @@ IF (BUILD_TESTING) ENABLE_TESTING () INCLUDE (CTest) IF (NOT HDF5_EXTERNALLY_CONFIGURED) - IF(EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + IF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test) - ENDIF(EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") - IF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + IF (EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/perform ${PROJECT_BINARY_DIR}/perform) ENDIF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -512,59 +528,59 @@ ENDIF (BUILD_TESTING) # Set default name mangling : overridden by Fortran detection in fortran dir SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _") SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") -IF(EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") +IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) IF (HDF5_BUILD_FORTRAN) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) IF (HDF5_BUILD_HL_LIB) - IF(EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") + IF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${HDF5_BINARY_DIR}/hl/fortran) - ENDIF(EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") ENDIF (HDF5_BUILD_HL_LIB) ENDIF (HDF5_BUILD_FORTRAN) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") #----------------------------------------------------------------------------- # Option to build examples #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") +IF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") OPTION (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" OFF) IF (HDF5_BUILD_EXAMPLES) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples) ENDIF (HDF5_BUILD_EXAMPLES) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") #----------------------------------------------------------------------------- # Option to build HDF5 C++ Library #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") +IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) IF (HDF5_BUILD_CPP_LIB) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") #----------------------------------------------------------------------------- # Option to build HDF5 Tools #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") +IF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") OPTION (HDF5_BUILD_TOOLS "Build HDF5 Tools" OFF) IF (HDF5_BUILD_TOOLS) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) ENDIF (HDF5_BUILD_TOOLS) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") #----------------------------------------------------------------------------- # Option to build High Level API's #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") +IF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") OPTION (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" OFF) IF (HDF5_BUILD_HL_LIB) SET (H5_INCLUDE_HL 1) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl) ENDIF (HDF5_BUILD_HL_LIB) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation @@ -574,36 +590,43 @@ CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubcon #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( - FILES - ${PROJECT_BINARY_DIR}/H5pubconf.h - DESTINATION - include - COMPONENT - headers -) +IF (NOT HDF5_INSTALL_NO_DEVELOPMENT) + INSTALL ( + FILES + ${PROJECT_BINARY_DIR}/H5pubconf.h + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + headers + ) +ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -INSTALL ( - EXPORT - ${HDF5_EXPORTED_TARGETS} - DESTINATION - lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} - FILE - hdf5-targets.cmake -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + INSTALL ( + EXPORT + ${HDF5_EXPORTED_TARGETS} + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + FILE + hdf5-targets.cmake + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Export all exported targets to the build tree for use by parent project #----------------------------------------------------------------------------- -EXPORT ( - TARGETS - ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} - FILE - hdf5-targets.cmake -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + EXPORT ( + TARGETS + ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} + FILE + hdf5-targets.cmake + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the build directory #----------------------------------------------------------------------------- @@ -623,16 +646,34 @@ CONFIGURE_FILE ( #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- -CONFIGURE_FILE ( - ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY -) -INSTALL ( - FILES - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake - DESTINATION - lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY + ) + INSTALL ( + FILES + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#----------------------------------------------------------------------------- +# Configure the hdf5-config-version .cmake file for the install directory +#----------------------------------------------------------------------------- +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/hdf5-config-version.cmake.in + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake @ONLY + ) + INSTALL ( + FILES + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Set the cpack variables diff --git a/MANIFEST b/MANIFEST index 882f31f..274b5a4 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1488,7 +1488,6 @@ ./tools/testfiles/torderattr1.h5.xml - #test files for h5diff ./tools/h5diff/testfiles/h5diff_10.txt ./tools/h5diff/testfiles/h5diff_11.txt @@ -1669,8 +1668,6 @@ ./tools/h5jam/testfiles/twithub513.h5 ./tools/h5jam/testfiles/u513.txt - - # test files for h5copy ./tools/h5copy/testfiles/h5copytst.h5 ./tools/h5copy/testfiles/h5copytst.out.ls @@ -1797,7 +1794,6 @@ ./hl/tools/gif2h5/testfiles/image1.gif ./hl/tools/gif2h5/testfiles/h52giftst.h5 - # hl fortran ./hl/fortran/COPYING ./hl/fortran/Makefile.am @@ -1898,10 +1894,10 @@ ./config/cmake/CheckTypeSize.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in -./config/cmake/hdf5_zlib.h.in ./config/cmake/FindHDF5.cmake ./config/cmake/hdf5-config.cmake.build.in ./config/cmake/hdf5-config.cmake.install.in +./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDF5Macros.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/cacheinit.cmake diff --git a/config/cmake/FindSZIP.cmake b/config/cmake/FindSZIP.cmake index 190b0b5..6118f7a 100644 --- a/config/cmake/FindSZIP.cmake +++ b/config/cmake/FindSZIP.cmake @@ -8,10 +8,10 @@ # SZIP_FOUND, If false, do not try to use SZIP. # also defined, but not for general use are # SZIP_LIBRARY, where to find the SZIP library. -# SZIP_LIBRARY_DEBUG - Debug version of tiff library -# SZIP_LIBRARY_RELEASE - Release Version of tiff library +# SZIP_LIBRARY_DEBUG - Debug version of SZIP library +# SZIP_LIBRARY_RELEASE - Release Version of SZIP library -# MESSAGE (STATUS "Finding Szip library and headers..." ) +# MESSAGE (STATUS "Finding SZIP library and headers..." ) ############################################ # diff --git a/config/cmake/hdf5-config-version.cmake.in b/config/cmake/hdf5-config-version.cmake.in new file mode 100644 index 0000000..c1201cc --- /dev/null +++ b/config/cmake/hdf5-config-version.cmake.in @@ -0,0 +1,27 @@ +#----------------------------------------------------------------------------- +# HDF5 Version file for install directory +#----------------------------------------------------------------------------- + +SET (PACKAGE_VERSION @HDF5_VERSION_STRING@) + +IF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@) + + # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@ + IF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@) + + # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x + SET (PACKAGE_VERSION_COMPATIBLE 1) + + IF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@) + SET (PACKAGE_VERSION_EXACT 1) + + IF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@) + # not using this yet + ENDIF ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H5_VERS_SUBRELEASE@) + + ENDIF ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H5_VERS_RELEASE@) + + ENDIF ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H5_VERS_MINOR@) +ENDIF ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H5_VERS_MAJOR@) + + diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in index 132e8be..ecbde48 100644 --- a/config/cmake/hdf5-config.cmake.build.in +++ b/config/cmake/hdf5-config.cmake.build.in @@ -1,42 +1,50 @@ #----------------------------------------------------------------------------- # HDF5 Config file for compiling against hdf5 build directory #----------------------------------------------------------------------------- - -SET (HDF5_INCLUDE_DIRS "@HDF5_INCLUDES_BUILD_TIME@") +GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) #----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already build hdf5 as a subproject +# User Options #----------------------------------------------------------------------------- -IF (NOT TARGET "hdf5" AND NOT HDF5_INSTALL_SKIP_TARGETS) - GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - INCLUDE (${SELF_DIR}/HDF5-targets.cmake) -ENDIF (NOT TARGET "hdf5" AND NOT HDF5_INSTALL_SKIP_TARGETS) - -SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -# -# To be continued ... -# -# XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry. -# XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry. -# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include -# XXX_EXECUTABLE Where to find the XXX tool. -# XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX. -# XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry. -# XXX_ROOT_DIR Where to find the base directory of XXX. -# XXX_VERSION_YY Expect Version YY if true. Make sure at most one of these is ever true. -# XXX_WRAP_YY If False, do not try to use the relevent CMake wrapping command. -# XXX_YY_FOUND If False, optional YY part of XXX sytem is not available. -# XXX_FOUND Set to false, or undefined, if we haven't found, or don't want to use XXX. -# XXX_RUNTIME_LIBRARY_DIRS Optionally, the runtime library search path for use when running an executable linked to shared libraries. -# The list should be used by user code to create the PATH on windows or LD_LIBRARY_PATH on unix. -# This should not be a cache entry. +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +SET (HDF5_INCLUDE_DIR "@HDF5_INCLUDES_BUILD_TIME@") + +IF (HDF5_BUILD_FORTRAN) + SET (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" ) +ENDIF (HDF5_BUILD_FORTRAN) + +IF (HDF5_BUILD_CPP_LIB) + SET (HDF5_INCLUDE_DIR_CPP ${HDF5_INCLUDE_DIR} ) +ENDIF (HDF5_BUILD_CPP_LIB) + +IF (HDF5_BUILD_HL_LIB) + SET (HDF5_INCLUDE_DIR_HL ${HDF5_INCLUDE_DIR} ) +ENDIF (HDF5_BUILD_HL_LIB) + +IF (HDF5_BUILD_TOOLS) + SET (HDF5_INCLUDE_DIR_CPP ${HDF5_INCLUDE_DIR} ) +ENDIF (HDF5_BUILD_TOOLS) + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) +SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already build hdf5 as a subproject +#----------------------------------------------------------------------------- +IF (NOT TARGET "hdf5") + GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + INCLUDE (${SELF_DIR}/hdf5-targets.cmake) +ENDIF (NOT TARGET "hdf5") diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in index 2c33edf..4fda6e8 100644 --- a/config/cmake/hdf5-config.cmake.install.in +++ b/config/cmake/hdf5-config.cmake.install.in @@ -1,35 +1,62 @@ #----------------------------------------------------------------------------- # HDF5 Config file for compiling against hdf5 install directory #----------------------------------------------------------------------------- - GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -GET_FILENAME_COMPONENT (HDF5_INCLUDE_DIRS "${SELF_DIR}/../include" ABSOLUTE) -SET (HDF5_FORTRAN_DIR ${HDF5_INCLUDE_DIRS}/fortran) #----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already build hdf5 as a subproject +# User Options #----------------------------------------------------------------------------- -IF (NOT TARGET "hdf5") - INCLUDE (${SELF_DIR}/HDF5-targets.cmake) -ENDIF (NOT TARGET "hdf5") - -SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - SET (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) SET (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) SET (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) SET (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) SET (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +SET (HDF5_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" ) + +IF (HDF5_BUILD_FORTRAN) + SET (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_INSTALL_PREFIX@/include/fortran" ) +ENDIF (HDF5_BUILD_FORTRAN) + +IF (HDF5_BUILD_CPP_LIB) + SET (HDF5_INCLUDE_DIR_CPP "@CMAKE_INSTALL_PREFIX@/include/cpp" ) +ENDIF (HDF5_BUILD_CPP_LIB) + +IF (HDF5_BUILD_HL_LIB) + SET (HDF5_INCLUDE_DIR_HL "@CMAKE_INSTALL_PREFIX@/include/hl" ) +ENDIF (HDF5_BUILD_HL_LIB) + +IF (HDF5_BUILD_TOOLS) + SET (HDF5_INCLUDE_DIR_CPP "@CMAKE_INSTALL_PREFIX@/include/tools" ) +ENDIF (HDF5_BUILD_TOOLS) + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +SET (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) +SET (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +SET (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already built hdf5 as a subproject +#----------------------------------------------------------------------------- +IF (NOT TARGET "hdf5") + INCLUDE (${SELF_DIR}/hdf5-targets.cmake) +ENDIF (NOT TARGET "hdf5") + +#----------------------------------------------------------------------------- +# Unfinished +#----------------------------------------------------------------------------- # -# To be continued ... +# To be continued (maybe) ... # -# XXX_INCLUDE_DIRS The final set of include directories listed in one variable for use by client code. This should not be a cache entry. -# XXX_LIBRARIES The libraries to link against to use XXX. These should include full paths. This should not be a cache entry. -# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include +# XXX_INCLUDE_DIRS no, use one per library as in HDF5_FORTRAN_INCLUDE_DIR +# XXX_LIBRARIES not needed - see hdf5-targets.cmake +# XXX_DEFINITIONS Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG) that a client source-code file uses to decide whether to #include # XXX_EXECUTABLE Where to find the XXX tool. # XXX_YYY_EXECUTABLE Where to find the YYY tool that comes with XXX. # XXX_LIBRARY_DIRS Optionally, the final set of library directories listed in one variable for use by client code. This should not be a cache entry. diff --git a/config/cmake/hdf5_zlib.h.in b/config/cmake/hdf5_zlib.h.in deleted file mode 100644 index 104db27..0000000 --- a/config/cmake/hdf5_zlib.h.in +++ /dev/null @@ -1 +0,0 @@ -#include <@H5_ZLIB_HEADER@> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3e9366a..3f40dda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -465,6 +465,10 @@ SET (H5Z_SRCS ${HDF5_SRC_DIR}/H5Zszip.c ${HDF5_SRC_DIR}/H5Ztrans.c ) +IF (H5_ZLIB_HEADER) + SET_PROPERTY(SOURCE ${HDF5_SRC_DIR}/H5Zdeflate.c PROPERTY + COMPILE_DEFINITIONS H5_ZLIB_HEADER="${H5_ZLIB_HEADER}") +ENDIF (H5_ZLIB_HEADER) SET (H5Z_HDRS ${HDF5_SRC_DIR}/H5Zpkg.h @@ -695,15 +699,17 @@ H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} ${LIB_TYPE}) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( - FILES - ${H5_PUBLIC_HEADERS} - ${H5_PRIVATE_HEADERS} - DESTINATION - include - COMPONENT - headers -) +IF (NOT HDF5_INSTALL_NO_DEVELOPMENT) + INSTALL ( + FILES + ${H5_PUBLIC_HEADERS} + ${H5_PRIVATE_HEADERS} + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + headers + ) +ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects @@ -714,8 +720,8 @@ IF (HDF5_EXPORTED_TARGETS) ${HDF5_LIB_TARGET} EXPORT ${HDF5_EXPORTED_TARGETS} - LIBRARY DESTINATION lib COMPONENT libraries - ARCHIVE DESTINATION lib COMPONENT libraries - RUNTIME DESTINATION bin COMPONENT libraries + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries ) ENDIF (HDF5_EXPORTED_TARGETS) diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index c490720..63e7b9a 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -28,8 +28,11 @@ #ifdef H5_HAVE_FILTER_DEFLATE -#ifdef H5_HAVE_ZLIB_H -# include "zlib.h" +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +# define H5_ZLIB_HEADER "zlib.h" +#endif +#if defined(H5_ZLIB_HEADER) +# include H5_ZLIB_HEADER /* "zlib.h" */ #endif /* Local function prototypes */ -- cgit v0.12