BasicConfigVersion-ExactVersion.cmake.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 equal to the requested version.
  8. # The tweak version component is ignored.
  9. # The variable CVF_VERSION must be set before calling configure_file().
  10. set(PACKAGE_VERSION "@CVF_VERSION@")
  11. if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
  12. set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
  13. else()
  14. set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
  15. endif()
  16. if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
  17. set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
  18. else()
  19. set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
  20. endif()
  21. if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
  22. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  23. else()
  24. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  25. endif()
  26. if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
  27. set(PACKAGE_VERSION_EXACT TRUE)
  28. endif()
  29. # if the installed project requested no architecture check, don't perform the check
  30. if("@CVF_ARCH_INDEPENDENT@")
  31. return()
  32. endif()
  33. # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
  34. if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
  35. return()
  36. endif()
  37. # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  38. if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  39. math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  40. set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  41. set(PACKAGE_VERSION_UNSUITABLE TRUE)
  42. endif()