summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-14 10:27:42 -0400
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-14 10:27:42 -0400
commita86ddbe56e1659ca1385514e1ffe1a9389d9ca62 (patch)
tree460f5585667f51eae5d81714c3979702592632cb
parenteb9323eb1aa2beb32d933c3e09a160939ff31682 (diff)
parent5685817874e25bb1e8b112e66186eec4345c4635 (diff)
downloadcmake-a86ddbe56e1659ca1385514e1ffe1a9389d9ca62.tar.gz
Merge topic 'FindHDF5-version-support'
56858178 FindHDF5: Add version support 4bd122ad FindHDF5: Check for a few H5pubconf*.h name variants
-rw-r--r--Modules/FindHDF5.cmake25
-rw-r--r--Tests/CMakeOnly/AllFindModules/CMakeLists.txt4
2 files changed, 22 insertions, 7 deletions
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 0d58e132cc..3bd6f1e680 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -51,6 +51,7 @@
# bindings.
# HDF5_LIBRARIES - Required libraries for all requested bindings
# HDF5_FOUND - true if HDF5 was found on the system
+# HDF5_VERSION - HDF5 version in format Major.Minor.Release
# HDF5_LIBRARY_DIRS - the full set of library directories
# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support
# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler
@@ -59,6 +60,7 @@
# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
#=============================================================================
+# Copyright 2015 Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
# Copyright 2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
@@ -335,15 +337,28 @@ if( NOT HDF5_FOUND )
# If the HDF5 include directory was found, open H5pubconf.h to determine if
# HDF5 was compiled with parallel IO support
set( HDF5_IS_PARALLEL FALSE )
+ set( HDF5_VERSION "" )
foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
- if( EXISTS "${_dir}/H5pubconf.h" )
- file( STRINGS "${_dir}/H5pubconf.h"
+ foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h")
+ if( EXISTS "${_hdr}" )
+ file( STRINGS "${_hdr}"
HDF5_HAVE_PARALLEL_DEFINE
REGEX "HAVE_PARALLEL 1" )
if( HDF5_HAVE_PARALLEL_DEFINE )
set( HDF5_IS_PARALLEL TRUE )
endif()
+ unset(HDF5_HAVE_PARALLEL_DEFINE)
+
+ file( STRINGS "${_hdr}"
+ HDF5_VERSION_DEFINE
+ REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
+ if( "${HDF5_VERSION_DEFINE}" MATCHES
+ "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"" )
+ set( HDF5_VERSION "${CMAKE_MATCH_1}" )
+ endif()
+ unset(HDF5_VERSION_DEFINE)
endif()
+ endforeach()
endforeach()
set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
"HDF5 library compiled with parallel IO support" )
@@ -357,8 +372,8 @@ if( NOT HDF5_FOUND )
endif()
-find_package_handle_standard_args( HDF5 DEFAULT_MSG
- HDF5_LIBRARIES
- HDF5_INCLUDE_DIRS
+find_package_handle_standard_args( HDF5
+ REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
+ VERSION_VAR HDF5_VERSION
)
diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
index 15493be41b..bdc25639cd 100644
--- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
+++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt
@@ -86,8 +86,8 @@ foreach(VTEST ALSA ARMADILLO BZIP2 CUPS CURL EXPAT FREETYPE GETTEXT GIT HG
check_version_string(${VTEST} ${VTEST}_VERSION_STRING)
endforeach()
-foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2 LibArchive OPENSCENEGRAPH
- RUBY SWIG)
+foreach(VTEST BISON Boost CUDA DOXYGEN FLEX GIF GTK2
+ HDF5 LibArchive OPENSCENEGRAPH RUBY SWIG)
check_version_string(${VTEST} ${VTEST}_VERSION)
endforeach()