aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/protobuf-config-version.cmake.in
blob: cc11037a2c49287d77a72c9aa14863492e62626b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This is a basic version file for the Config-mode of find_package().
# It is derived from the format suggested in the CMake module
# CMakePackageConfigHelpers. introduced in CMake 2.8.8.
# If the cmake_minimum_required version is ever bumped to 2.8.8 or
# above, this file may be deleted and replaced with a call to
# write_basic_package_version_file(...)

set(PACKAGE_VERSION @protobuf_VERSION@)

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

  if(PACKAGE_FIND_VERSION_MAJOR STREQUAL @protobuf_VERSION_MAJOR@)
    set(PACKAGE_VERSION_COMPATIBLE TRUE)
  else()
    set(PACKAGE_VERSION_COMPATIBLE FALSE)
  endif()

  if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
      set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()


# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
   return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
  math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
  set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()