Skip to content

Commit 10a09e0

Browse files
Al-Nuaimi Ibraheemrbsheth
authored andcommitted
Use hunter protobuf
1 parent d8411f0 commit 10a09e0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cmake/OpenCVFindProtobuf.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if(NOT WITH_PROTOBUF)
66
return()
77
endif()
88

9-
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf runtime from sources" ON)
10-
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" OFF)
9+
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf runtime from sources" OFF)
10+
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" ON)
1111

1212
# BUILD_PROTOBUF=OFF: Custom manual protobuf configuration (see find_package(Protobuf) for details):
1313
# - Protobuf_INCLUDE_DIR
@@ -31,6 +31,7 @@ if(BUILD_PROTOBUF)
3131
set(HAVE_PROTOBUF TRUE)
3232
else()
3333
unset(Protobuf_VERSION CACHE)
34+
hunter_add_package(Protobuf)
3435
find_package(Protobuf QUIET)
3536

3637
# Backwards compatibility
@@ -68,7 +69,12 @@ else()
6869
endif()
6970

7071
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
71-
message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
72+
# message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
73+
hunter_add_package(Protobuf)
74+
find_package(Protobuf QUIET)
75+
if(NOT COMMAND PROTOBUF_GENERATE_CPP)
76+
message(FATAL_ERROR "PROTOBUF_GENERATE_CPP command is not available")
77+
endif()
7278
endif()
7379

7480
if(HAVE_PROTOBUF)

0 commit comments

Comments
 (0)