BasicConfigVersion-SameMajorVersion.cmake.in 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # This is a basic file for the new style find_package() search mode,
  2. # i.e. Config-mode.
  3. # It is used by WriteBasicConfigVersionFile.cmake as input file for configure_file()
  4. # to create a version-file which can be installed along a config.cmake file.
  5. #
  6. # The created file sets PACKAGE_VERSION_EXACT if the current version string and
  7. # the requested version string are exactly the same and it sets
  8. # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
  9. # but only if the requested major version is the same as the current one.
  10. # The variable CVF_VERSION must be set before calling configure_file().
  11. set(PACKAGE_VERSION "@CVF_VERSION@")
  12. set(PACKAGE_VERSION_EXACT FALSE) # initialize to FALSE
  13. # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  14. if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  15. math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  16. set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  17. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  18. else()
  19. if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
  20. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  21. else()
  22. if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.")
  23. set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
  24. else()
  25. set(CVF_VERSION_MAJOR "@CVF_VERSION@")
  26. endif()
  27. if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}")
  28. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  29. else()
  30. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  31. endif()
  32. if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
  33. set(PACKAGE_VERSION_EXACT TRUE)
  34. endif()
  35. endif()
  36. endif()