diff options
author | Walter Gray <wgray@leapmotion.com> | 2017-05-30 14:07:34 -0700 |
---|---|---|
committer | Walter Gray <wgray@leapmotion.com> | 2017-05-30 15:04:11 -0700 |
commit | ae85cb8ef3c763eb506c945fe68f8bf0f95f3728 (patch) | |
tree | 024d5aa177b7555153358bc42f79a458fcbb82aa | |
parent | d6470abef1ca76c40e6da3b4445b7c32f1d0e2e3 (diff) | |
download | protobuf-ae85cb8ef3c763eb506c945fe68f8bf0f95f3728.tar.gz protobuf-ae85cb8ef3c763eb506c945fe68f8bf0f95f3728.tar.bz2 protobuf-ae85cb8ef3c763eb506c945fe68f8bf0f95f3728.zip |
Fix find module not working when no version number was given
-rw-r--r-- | cmake/protobuf-config-version.cmake.in | 26 |
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() |