aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/protobuf-config-version.cmake.in
diff options
context:
space:
mode:
authorGravatar Walter Gray <wgray@leapmotion.com>2017-05-30 14:07:34 -0700
committerGravatar Walter Gray <wgray@leapmotion.com>2017-05-30 15:04:11 -0700
commitae85cb8ef3c763eb506c945fe68f8bf0f95f3728 (patch)
tree024d5aa177b7555153358bc42f79a458fcbb82aa /cmake/protobuf-config-version.cmake.in
parentd6470abef1ca76c40e6da3b4445b7c32f1d0e2e3 (diff)
Fix find module not working when no version number was given
Diffstat (limited to 'cmake/protobuf-config-version.cmake.in')
-rw-r--r--cmake/protobuf-config-version.cmake.in26
1 files changed, 14 insertions, 12 deletions
diff --git a/cmake/protobuf-config-version.cmake.in b/cmake/protobuf-config-version.cmake.in
index 0036c9ef..8d391254 100644
--- a/cmake/protobuf-config-version.cmake.in
+++ b/cmake/protobuf-config-version.cmake.in
@@ -17,20 +17,22 @@ endif()
set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise
-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)
-elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
- # Do not match prerelease versions to non-prerelease version requests.
- if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "")
- message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.")
+if(PACKAGE_FIND_VERSION) #Only perform version checks if one is given
+ if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
- endif()
-
- # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers.
- if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@")
+ elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
+ # Do not match prerelease versions to non-prerelease version requests.
+ if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "")
+ message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
+
+ # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers.
+ if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+ endif()
endif()
endif()