diff options
author | Diego Pino Garcia <dpino@igalia.com> | 2019-12-09 09:02:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-12-16 16:43:47 (GMT) |
commit | db0b740fd812271d623afc2085f0a3ce4f82ea88 (patch) | |
tree | 05a63d4c2b559284e58949bf99f6795b1162e752 /Modules/FindProtobuf.cmake | |
parent | 2d53894c31c9d6849c67f4c218c0aefed1eb7921 (diff) | |
download | CMake-db0b740fd812271d623afc2085f0a3ce4f82ea88.zip CMake-db0b740fd812271d623afc2085f0a3ce4f82ea88.tar.gz CMake-db0b740fd812271d623afc2085f0a3ce4f82ea88.tar.bz2 |
FindProtobuf: Do not verify protoc version if it is not found
Diffstat (limited to 'Modules/FindProtobuf.cmake')
-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) |