BasicConfigVersion-SameMinorVersion.cmake.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 "@CVF_VERSION@")
  12. if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  13. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  14. else()
  15. if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)")
  16. set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
  17. set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
  18. else()
  19. set(CVF_VERSION_MAJOR "@CVF_VERSION@")
  20. set(CVF_VERSION_MINOR "")
  21. endif()
  22. if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
  23. (PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
  24. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  25. else()
  26. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  27. endif()
  28. if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
  29. set(PACKAGE_VERSION_EXACT TRUE)
  30. endif()
  31. endif()
  32. # if the installed project requested no architecture check, don't perform the check
  33. if("@CVF_ARCH_INDEPENDENT@")
  34. return()
  35. endif()
  36. # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
  37. if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
  38. return()
  39. endif()
  40. # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  41. if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  42. math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  43. set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  44. set(PACKAGE_VERSION_UNSUITABLE TRUE)
  45. endif()