protobuf-config-version.cmake.in 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # This is a basic version file for the Config-mode of find_package().
  2. # It is derived from the format suggested in the CMake module
  3. # CMakePackageConfigHelpers. introduced in CMake 2.8.8.
  4. # If the cmake_minimum_required version is ever bumped to 2.8.8 or
  5. # above, this file may be deleted and replaced with a call to
  6. # write_basic_package_version_file(...)
  7. set(PACKAGE_VERSION @protobuf_VERSION@)
  8. if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  9. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  10. else()
  11. if(PACKAGE_FIND_VERSION_MAJOR STREQUAL @protobuf_VERSION_MAJOR@)
  12. set(PACKAGE_VERSION_COMPATIBLE TRUE)
  13. else()
  14. set(PACKAGE_VERSION_COMPATIBLE FALSE)
  15. endif()
  16. if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
  17. set(PACKAGE_VERSION_EXACT TRUE)
  18. endif()
  19. endif()
  20. # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
  21. if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
  22. return()
  23. endif()
  24. # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
  25. if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  26. math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  27. set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  28. set(PACKAGE_VERSION_UNSUITABLE TRUE)
  29. endif()