File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ if(NOT USERVER_FORCE_DOWNLOAD_PROTOBUF)
4141 if (USERVER_DOWNLOAD_PACKAGE_PROTOBUF)
4242 find_package (Protobuf QUIET )
4343 else ()
44- find_package (Protobuf)
44+ find_package (Protobuf CONFIG)
45+ if (NOT Protobuf_FOUND)
46+ find_package (Protobuf)
47+ endif ()
4548 if (NOT Protobuf_FOUND)
4649 message (
4750 FATAL_ERROR
Original file line number Diff line number Diff line change @@ -52,7 +52,13 @@ function(_userver_prepare_grpc)
5252 elseif (protobuf_INCLUDE_DIRS)
5353 set_property (GLOBAL PROPERTY userver_protobuf_import_dir "${protobuf_INCLUDE_DIRS} " )
5454 else ()
55- message (FATAL_ERROR "Invalid Protobuf package" )
55+ # maybe we found protobuf config
56+ get_target_property (_incs protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES )
57+ if (_incs)
58+ set_property (GLOBAL PROPERTY userver_protobuf_import_dir "${_incs} " )
59+ else ()
60+ message (FATAL_ERROR "Invalid Protobuf package" )
61+ endif ()
5662 endif ()
5763
5864 if (NOT Protobuf_VERSION)
@@ -61,7 +67,7 @@ function(_userver_prepare_grpc)
6167 if (NOT gRPC_VERSION)
6268 message (FATAL_ERROR "Invalid gRPC package" )
6369 endif ()
64- if (NOT PROTOBUF_PROTOC)
70+ if (NOT PROTOBUF_PROTOC AND NOT TARGET protobuf::libprotoc )
6571 message (FATAL_ERROR "protoc not found" )
6672 endif ()
6773 if (NOT PROTO_GRPC_CPP_PLUGIN)
You can’t perform that action at this time.
0 commit comments