Skip to content

Commit 923b8e4

Browse files
author
Al-Nuaimi Ibraheem
committed
Hunter protobuf will only be used in unix
1 parent b76c23c commit 923b8e4

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

cmake/OpenCVFindProtobuf.cmake

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

9-
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf from sources" OFF)
10-
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" ON)
9+
if(CMAKE_HOST_UNIX)
10+
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf from sources" OFF)
11+
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" ON)
12+
else()
13+
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf from sources" ON)
14+
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" OFF)
15+
endif()
1116

1217
function(get_protobuf_version version include)
1318
file(STRINGS "${include}/google/protobuf/stubs/common.h" ver REGEX "#define GOOGLE_PROTOBUF_VERSION [0-9]+")
@@ -23,7 +28,9 @@ if(BUILD_PROTOBUF)
2328
set(HAVE_PROTOBUF TRUE)
2429
else()
2530
unset(Protobuf_VERSION CACHE)
26-
hunter_add_package(Protobuf)
31+
if(CMAKE_HOST_UNIX)
32+
hunter_add_package(Protobuf)
33+
endif()
2734
find_package(Protobuf QUIET)
2835

2936
# Backwards compatibility
@@ -63,7 +70,9 @@ else()
6370
endif()
6471

6572
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
66-
hunter_add_package(Protobuf)
73+
if(CMAKE_HOST_UNIX)
74+
hunter_add_package(Protobuf)
75+
endif()
6776
find_package(Protobuf QUIET)
6877
if(NOT COMMAND PROTOBUF_GENERATE_CPP)
6978
message(FATAL_ERROR "PROTOBUF_GENERATE_CPP command is not available")

modules/dnn/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ else()
8989
set(__lapack_libraries ${LAPACK_LIBRARIES})
9090
endif()
9191

92-
set(libs protobuf::libprotobuf ${LAPACK_LIBRARIES})
92+
if(CMAKE_HOST_UNIX)
93+
set(libs protobuf::libprotobuf ${LAPACK_LIBRARIES})
94+
else()
95+
set(libs libprotobuf ${LAPACK_LIBRARIES})
96+
endif()
9397

9498
if(OPENCV_DNN_OPENCL AND HAVE_OPENCL)
9599
list(APPEND include_dirs ${OPENCL_INCLUDE_DIRS})

0 commit comments

Comments
 (0)