aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/protobuf-config-version.cmake.in
diff options
context:
space:
mode:
authorGravatar Walter Gray <wgray@leapmotion.com>2016-05-19 15:24:18 -0700
committerGravatar Walter Gray <wgray@leapmotion.com>2016-05-19 15:25:03 -0700
commit02a28a8feac897ee414357782a4f5121efd47ff7 (patch)
tree68f36c644bc5eda3d5ce16629cd5d1086d7ec203 /cmake/protobuf-config-version.cmake.in
parentc034ba768f244930a476e484334e69b9a6f26931 (diff)
Update protobuf-config-version.cmake.in to correctly set the required variables (PACKAGE_VERSION_EXACT, PACKAGE_VERSION_COMPATIBLE, PACKAGE_VERSION_UNSUITABLE)
Diffstat (limited to 'cmake/protobuf-config-version.cmake.in')
-rw-r--r--cmake/protobuf-config-version.cmake.in35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/protobuf-config-version.cmake.in b/cmake/protobuf-config-version.cmake.in
index 1f171c66..cc11037a 100644
--- a/cmake/protobuf-config-version.cmake.in
+++ b/cmake/protobuf-config-version.cmake.in
@@ -1 +1,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()