diff options
author | Brad King <brad.king@kitware.com> | 2019-12-17 16:07:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-12-17 16:08:12 (GMT) |
commit | 7d69ab02adcad7baf72facd2c29ef232d230ce01 (patch) | |
tree | 086e687cf24dfd6db301b8e25f2bc551c493248b | |
parent | 671ed5b123101b2abb060ccfad7a71836bd29708 (diff) | |
parent | db0b740fd812271d623afc2085f0a3ce4f82ea88 (diff) | |
download | CMake-7d69ab02adcad7baf72facd2c29ef232d230ce01.zip CMake-7d69ab02adcad7baf72facd2c29ef232d230ce01.tar.gz CMake-7d69ab02adcad7baf72facd2c29ef232d230ce01.tar.bz2 |
Merge topic 'FindProtobuf-no-protoc'
db0b740fd8 FindProtobuf: Do not verify protoc version if it is not found
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4121
-rw-r--r-- | Modules/FindProtobuf.cmake | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 2d45965..f35978d 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -482,22 +482,24 @@ if(Protobuf_INCLUDE_DIR) "${_PROTOBUF_COMMON_HEADER} reveals protobuf ${Protobuf_VERSION}") endif() - # Check Protobuf compiler version to be aligned with libraries version - execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} --version - OUTPUT_VARIABLE _PROTOBUF_PROTOC_EXECUTABLE_VERSION) + if(Protobuf_PROTOC_EXECUTABLE) + # Check Protobuf compiler version to be aligned with libraries version + execute_process(COMMAND ${Protobuf_PROTOC_EXECUTABLE} --version + OUTPUT_VARIABLE _PROTOBUF_PROTOC_EXECUTABLE_VERSION) - if("${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" MATCHES "libprotoc ([0-9.]+)") - set(_PROTOBUF_PROTOC_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") - endif() + if("${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" MATCHES "libprotoc ([0-9.]+)") + set(_PROTOBUF_PROTOC_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") + endif() - if(Protobuf_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}") - endif() + if(Protobuf_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "${Protobuf_PROTOC_EXECUTABLE} reveals version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}") + endif() - if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}") + if(NOT "${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" VERSION_EQUAL "${Protobuf_VERSION}") message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" - " doesn't match library version ${Protobuf_VERSION}") + " doesn't match library version ${Protobuf_VERSION}") + endif() endif() if(Protobuf_LIBRARY) |