OLD | NEW |
1 set(PACKAGE_VERSION @protobuf_VERSION@) | 1 set(PACKAGE_VERSION "@protobuf_VERSION@") |
| 2 set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "@protobuf_VERSION_PRERELEASE@" PARE
NT_SCOPE) |
| 3 |
| 4 # Prerelease versions cannot be passed in directly via the find_package command, |
| 5 # so we allow users to specify it in a variable |
| 6 if(NOT DEFINED "${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE") |
| 7 set("${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}" "") |
| 8 else() |
| 9 set(PACKAGE_FIND_VERSION ${PACKAGE_FIND_VERSION}-${${PACKAGE_FIND_NAME}_FIND_V
ERSION_PRERELEASE}) |
| 10 endif() |
| 11 set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELE
ASE}") |
| 12 |
| 13 # VERSION_EQUAL ignores the prerelease strings, so we use STREQUAL. |
| 14 if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) |
| 15 set(PACKAGE_VERSION_EXACT TRUE) |
| 16 endif() |
| 17 |
| 18 set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise |
| 19 |
| 20 if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@") |
| 21 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 22 elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) |
| 23 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 24 elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) |
| 25 # Do not match prerelease versions to non-prerelease version requests. |
| 26 if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PR
ERELEASE STREQUAL "") |
| 27 message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAM
E}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERE
LEASE@' or greater.") |
| 28 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 29 endif() |
| 30 |
| 31 # Not robustly SemVer compliant, but protobuf never uses '.' separated prerele
ase identifiers. |
| 32 if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@") |
| 33 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
| 34 endif() |
| 35 endif() |
| 36 |
| 37 # Check and save build options used to create this package |
| 38 macro(_check_and_save_build_option OPTION VALUE) |
| 39 if(DEFINED ${PACKAGE_FIND_NAME}_${OPTION} AND |
| 40 NOT ${PACKAGE_FIND_NAME}_${OPTION} EQUAL VALUE) |
| 41 set(PACKAGE_VERSION_UNSUITABLE TRUE) |
| 42 endif() |
| 43 set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE}) |
| 44 endmacro() |
| 45 _check_and_save_build_option(WITH_ZLIB @protobuf_WITH_ZLIB@) |
| 46 _check_and_save_build_option(MSVC_STATIC_RUNTIME @protobuf_MSVC_STATIC_RUNTIME@) |
| 47 _check_and_save_build_option(BUILD_SHARED_LIBS @protobuf_BUILD_SHARED_LIBS@) |
| 48 |
| 49 # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, igno
re it: |
| 50 if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "" AND NOT "@CMAKE_SIZEOF_VOID_P@" STRE
QUAL "") |
| 51 # check that the installed version has the same 32/64bit-ness as the one which
is currently searching: |
| 52 if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") |
| 53 math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") |
| 54 set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") |
| 55 set(PACKAGE_VERSION_UNSUITABLE TRUE) |
| 56 endif() |
| 57 endif() |
| 58 |
OLD | NEW |