summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-07-14 15:02:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-07-14 15:03:09 (GMT)
commit6cb290559e1f459052c01b2f3234c93b31141fb7 (patch)
tree9aae34455538f3d8b5bfe3fdd02bcd4cc139e979
parent1f42b0299b75d92bd37b2daeaa320da40fa9cba5 (diff)
parent6e90d7957741975ce75edd1dcf871e6f4e760605 (diff)
downloadCMake-6cb290559e1f459052c01b2f3234c93b31141fb7.zip
CMake-6cb290559e1f459052c01b2f3234c93b31141fb7.tar.gz
CMake-6cb290559e1f459052c01b2f3234c93b31141fb7.tar.bz2
Merge topic 'FindProtobuf-version-schemes' into release-3.27
6e90d79577 FindProtobuf: Fix new version number scheme Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8629
-rw-r--r--Modules/FindProtobuf.cmake10
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index b2567c0..a92fb52 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -499,11 +499,7 @@ if(Protobuf_INCLUDE_DIR)
math(EXPR _PROTOBUF_MAJOR_VERSION "${Protobuf_LIB_VERSION} / 1000000")
math(EXPR _PROTOBUF_MINOR_VERSION "${Protobuf_LIB_VERSION} / 1000 % 1000")
math(EXPR _PROTOBUF_SUBMINOR_VERSION "${Protobuf_LIB_VERSION} % 1000")
- if (_PROTOBUF_MINOR_VERSION GREATER_EQUAL "21")
- set(Protobuf_VERSION "${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
- else()
- set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
- endif()
+ set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
if(Protobuf_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
@@ -524,7 +520,9 @@ if(Protobuf_INCLUDE_DIR)
"${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}")
endif()
- if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}")
+ # protoc version 22 and up don't print the major version any more
+ if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}" AND
+ NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}")
message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}"
" doesn't match library version ${Protobuf_VERSION}")
endif()