hdf5-config-version.cmake 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # This is a basic version file for the Config-mode of find_package().
  2. # It is used by write_basic_package_version_file() as input file for configure_file()
  3. # to create a version-file which can be installed along a config.cmake file.
  4. #
  5. # The created file sets PACKAGE_VERSION_EXACT if the current version string and
  6. # the requested version string are exactly the same and it sets
  7. # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
  8. # but only if the requested major and minor versions are the same as the current
  9. # one.
  10. # The variable CVF_VERSION must be set before calling configure_file().
  11. set(PACKAGE_VERSION "1.13.1")
  12. if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  13. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  14. else()
  15. if("1.13.1" MATCHES "^([0-9]+)\\.([0-9]+)")
  16. set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
  17. set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
  18. if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
  19. string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
  20. endif()
  21. if(NOT CVF_VERSION_MINOR VERSION_EQUAL 0)
  22. string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
  23. endif()
  24. else()
  25. set(CVF_VERSION_MAJOR "1.13.1")
  26. set(CVF_VERSION_MINOR "")
  27. endif()
  28. if(PACKAGE_FIND_VERSION_RANGE)
  29. # both endpoints of the range must have the expected major and minor versions
  30. math (EXPR CVF_VERSION_MINOR_NEXT "${CVF_VERSION_MINOR} + 1")
  31. if (NOT (PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
  32. AND PACKAGE_FIND_VERSION_MIN_MINOR STREQUAL CVF_VERSION_MINOR)
  33. OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
  34. AND NOT (PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR
  35. AND PACKAGE_FIND_VERSION_MAX_MINOR STREQUAL CVF_VERSION_MINOR))
  36. OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
  37. AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL ${CVF_VERSION_MAJOR}.${CVF_VERSION_MINOR_NEXT})))
  38. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  39. elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
  40. AND PACKAGE_FIND_VERSION_MIN_MINOR STREQUAL CVF_VERSION_MINOR
  41. AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
  42. OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
  43. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  44. else()
  45. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  46. endif()
  47. else()
  48. if(NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL 0)
  49. string(REGEX REPLACE "^0+" "" PACKAGE_FIND_VERSION_MAJOR "${PACKAGE_FIND_VERSION_MAJOR}")
  50. endif()
  51. if(NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL 0)
  52. string(REGEX REPLACE "^0+" "" PACKAGE_FIND_VERSION_MINOR "${PACKAGE_FIND_VERSION_MINOR}")
  53. endif()
  54. if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
  55. (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
  56. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  57. else()
  58. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  59. endif()
  60. if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
  61. set(PACKAGE_VERSION_EXACT TRUE)
  62. endif()
  63. endif()
  64. endif()
  65. # if the installed project requested no architecture check, don't perform the check
  66. if("FALSE")
  67. return()
  68. endif()
  69. # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
  70. if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
  71. return()
  72. endif()
  73. # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  74. if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
  75. math(EXPR installedBits "8 * 8")
  76. set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  77. set(PACKAGE_VERSION_UNSUITABLE TRUE)
  78. endif()