Skip to content

Commit fe51f29

Browse files
committed
fix review + conan
1 parent cfeb211 commit fe51f29

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cmake/SetupProtobuf.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if(NOT USERVER_FORCE_DOWNLOAD_PROTOBUF)
4141
if(USERVER_DOWNLOAD_PACKAGE_PROTOBUF)
4242
find_package(Protobuf QUIET)
4343
else()
44-
find_package(Protobuf CONFIG)
44+
find_package(Protobuf CONFIG QUIET)
4545
if (NOT Protobuf_FOUND)
4646
find_package(Protobuf)
4747
endif()
@@ -60,7 +60,7 @@ if(NOT USERVER_FORCE_DOWNLOAD_PROTOBUF)
6060

6161
if(Protobuf_FOUND)
6262
_userver_set_protobuf_version_category()
63-
set(PROTOBUF_PROTOC "${Protobuf_PROTOC_EXECUTABLE}")
63+
set(PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
6464
return()
6565
endif()
6666
endif()

cmake/UserverGrpcTargets.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ function(_userver_prepare_grpc)
5252
elseif(protobuf_INCLUDE_DIRS)
5353
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${protobuf_INCLUDE_DIRS}")
5454
else()
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}")
55+
# maybe we found the protobuf config
56+
get_target_property(Protobuf_INCLUDE_DIR protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES)
57+
if (Protobuf_INCLUDE_DIR)
58+
set_property(GLOBAL PROPERTY userver_protobuf_import_dir "${Protobuf_INCLUDE_DIR}")
5959
else()
6060
message(FATAL_ERROR "Invalid Protobuf package")
6161
endif()
@@ -67,7 +67,7 @@ function(_userver_prepare_grpc)
6767
if(NOT gRPC_VERSION)
6868
message(FATAL_ERROR "Invalid gRPC package")
6969
endif()
70-
if(NOT PROTOBUF_PROTOC AND NOT TARGET protobuf::libprotoc)
70+
if(NOT PROTOBUF_PROTOC)
7171
message(FATAL_ERROR "protoc not found")
7272
endif()
7373
if(NOT PROTO_GRPC_CPP_PLUGIN)

0 commit comments

Comments
 (0)