Skip to content

Commit b07be67

Browse files
authored
Merge pull request #1609 from gangliao/proto_3.1
Fix cmake find protobuf problem
2 parents 3048b1f + bd41a8c commit b07be67

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/external/protobuf.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ INCLUDE(ExternalProject)
1616

1717
FIND_PACKAGE(Protobuf 3.1)
1818

19+
IF(PROTOBUF_FOUND)
20+
EXEC_PROGRAM(${PROTOBUF_PROTOC_EXECUTABLE} ARGS --version OUTPUT_VARIABLE PROTOBUF_VERSION)
21+
STRING(REGEX MATCH "[0-9]+.[0-9]+" PROTOBUF_VERSION "${PROTOBUF_VERSION}")
22+
IF (${PROTOBUF_VERSION} VERSION_LESS "3.1.0")
23+
SET(PROTOBUF_FOUND OFF)
24+
ENDIF()
25+
ENDIF(PROTOBUF_FOUND)
26+
1927
IF(NOT PROTOBUF_FOUND)
2028
SET(PROTOBUF_SOURCES_DIR ${THIRD_PARTY_PATH}/protobuf)
2129
SET(PROTOBUF_INSTALL_DIR ${THIRD_PARTY_PATH}/install/protobuf)

0 commit comments

Comments
 (0)