1#
2# Copyright by The HDF Group.
3# All rights reserved.
4#
5# This file is part of HDF5.  The full HDF5 copyright notice, including
6# terms governing use, modification, and redistribution, is contained in
7# the COPYING file, which can be found at the root of the source code
8# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
9# If you do not have access to either file, you may request a copy from
10# help@hdfgroup.org.
11#
12#-----------------------------------------------------------------------------
13# HDF5 Version file for install directory
14#-----------------------------------------------------------------------------
15#
16# The created file sets PACKAGE_VERSION_EXACT if the current version string and
17# the requested version string are exactly the same and it sets
18# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
19# but only if the requested major.minor version is the same as the current one.
20# The variable HDF5_VERSION_STRING must be set before calling configure_file().
21
22set (PACKAGE_VERSION "@HDF5_VERSION_STRING@")
23
24if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
25  set(PACKAGE_VERSION_COMPATIBLE FALSE)
26else ()
27  if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H5_VERS_MAJOR@")
28
29    # exact match for version @H5_VERS_MAJOR@.@H5_VERS_MINOR@
30    if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H5_VERS_MINOR@")
31
32      # compatible with any version @H5_VERS_MAJOR@.@H5_VERS_MINOR@.x
33      set (PACKAGE_VERSION_COMPATIBLE TRUE)
34
35      if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H5_VERS_RELEASE@")
36        set (PACKAGE_VERSION_EXACT TRUE)
37
38        if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H5_VERS_SUBRELEASE@")
39          # not using this yet
40        endif ()
41      endif ()
42    else ()
43      set (PACKAGE_VERSION_COMPATIBLE FALSE)
44    endif ()
45  endif ()
46endif ()
47
48# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
49if("${CMAKE_SIZEOF_VOID_P}"  STREQUAL ""  OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
50   return()
51endif ()
52
53# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
54if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
55  math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
56  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
57  set(PACKAGE_VERSION_UNSUITABLE TRUE)
58endif ()
59