diff options
author | Jannik Beyerstedt <beyerstedt@consider-it.de> | 2023-06-19 15:29:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-06-20 13:59:53 (GMT) |
commit | fc7dcc6a24ffd33b780104ebd9dbb115d306827e (patch) | |
tree | 9b5159e51594fc275946f7bafc656a0f0e7e3b51 /Modules | |
parent | 21d409534a6ee884db9740f1e16f7d3d6bb950d8 (diff) | |
download | CMake-fc7dcc6a24ffd33b780104ebd9dbb115d306827e.zip CMake-fc7dcc6a24ffd33b780104ebd9dbb115d306827e.tar.gz CMake-fc7dcc6a24ffd33b780104ebd9dbb115d306827e.tar.bz2 |
FindProtobuf: Support new version number scheme
Protobuf changed it's version number scheme with version 21. The first number
(usually the major version) is not synchronized between compiler and library
version, but the second and third number are. See
https://protobuf.dev/news/2022-05-06/ for more details.
Fixes: #24847
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindProtobuf.cmake | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index c73a2d8..b046fcc 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -499,7 +499,11 @@ 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") - set(Protobuf_VERSION "${_PROTOBUF_MAJOR_VERSION}.${_PROTOBUF_MINOR_VERSION}.${_PROTOBUF_SUBMINOR_VERSION}") + 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() if(Protobuf_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " |