aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/protobuf-config-version.cmake.in
diff options
context:
space:
mode:
authorGravatar Walter Gray <wgray@leapmotion.com>2016-05-27 22:55:57 -0700
committerGravatar Walter Gray <wgray@leapmotion.com>2016-05-31 17:47:18 -0700
commit0420eab17301ee7baebaf3e1e08a08a24c7c432e (patch)
treee099351353f1cc3bcd0fe9882a413f1ec56ca0bd /cmake/protobuf-config-version.cmake.in
parentf1091ab1aa4924b44d05af19ec6b9bbf9b557b7e (diff)
For prerelease versions, require protobuf_FIND_VERSION to be set.
Diffstat (limited to 'cmake/protobuf-config-version.cmake.in')
-rw-r--r--cmake/protobuf-config-version.cmake.in38
1 files changed, 22 insertions, 16 deletions
diff --git a/cmake/protobuf-config-version.cmake.in b/cmake/protobuf-config-version.cmake.in
index cc11037a..5481022d 100644
--- a/cmake/protobuf-config-version.cmake.in
+++ b/cmake/protobuf-config-version.cmake.in
@@ -1,28 +1,32 @@
-# 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@")
-set(PACKAGE_VERSION @protobuf_VERSION@)
+if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+endif()
-if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
+set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise
- if(PACKAGE_FIND_VERSION_MAJOR STREQUAL @protobuf_VERSION_MAJOR@)
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- else()
+# Handle prerelease versions
+set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}")
+if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "")
+ if(NOT ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@'.")
endif()
- if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
- set(PACKAGE_VERSION_EXACT TRUE)
+ if(NOT "${PACKAGE_FIND_VERSION}-${PACKAGE_FIND_VERSION_PRERELEASE}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ else()
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+else()
+ if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
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()
@@ -34,3 +38,5 @@ if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
+
+set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "@protobuf_VERSION_PRERELEASE@" PARENT_SCOPE)