diff --git a/CMakeLists.txt b/CMakeLists.txt index b535f10..0fcb682 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1530,7 +1530,7 @@ target_link_libraries(grpc ${_gRPC_UPB_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} gpr - upb + ${_gRPC_UPB_LIBRARIES} ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) target_link_libraries(grpc "-framework CoreFoundation") @@ -1941,7 +1941,7 @@ target_link_libraries(grpc_cronet ${_gRPC_UPB_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} gpr - upb + ${_gRPC_UPB_LIBRARIES} ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) target_link_libraries(grpc_cronet "-framework CoreFoundation") @@ -2283,7 +2283,7 @@ target_link_libraries(grpc_test_util ${_gRPC_ALLTARGETS_LIBRARIES} gpr grpc - upb + ${_gRPC_UPB_LIBRARIES} ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) target_link_libraries(grpc_test_util "-framework CoreFoundation") @@ -2626,7 +2626,7 @@ target_link_libraries(grpc_test_util_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} gpr grpc_unsecure - upb + ${_gRPC_UPB_LIBRARIES} ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) target_link_libraries(grpc_test_util_unsecure "-framework CoreFoundation") @@ -3017,7 +3017,7 @@ target_link_libraries(grpc_unsecure ${_gRPC_UPB_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} gpr - upb + ${_gRPC_UPB_LIBRARIES} ) if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC) target_link_libraries(grpc_unsecure "-framework CoreFoundation") @@ -3553,7 +3553,7 @@ target_link_libraries(grpc++ ${_gRPC_ALLTARGETS_LIBRARIES} grpc gpr - upb + ${_gRPC_UPB_LIBRARIES} ) foreach(_hdr @@ -4817,7 +4817,7 @@ target_link_libraries(grpc++_unsecure ${_gRPC_ALLTARGETS_LIBRARIES} gpr grpc_unsecure - upb + ${_gRPC_UPB_LIBRARIES} ) foreach(_hdr @@ -5848,7 +5848,7 @@ if(gRPC_INSTALL) endif() endif() - +if(0) add_library(upb third_party/upb/upb/decode.c third_party/upb/upb/encode.c @@ -5888,10 +5888,10 @@ target_include_directories(upb target_link_libraries(upb ${_gRPC_ALLTARGETS_LIBRARIES} ) +endif() - -if(gRPC_INSTALL) +if(gRPC_INSTALL AND 0) install(TARGETS upb EXPORT gRPCTargets RUNTIME DESTINATION ${gRPC_INSTALL_BINDIR} LIBRARY DESTINATION ${gRPC_INSTALL_LIBDIR} diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in index 504d5a7..e2a3122 100644 --- a/cmake/gRPCConfig.cmake.in +++ b/cmake/gRPCConfig.cmake.in @@ -3,6 +3,7 @@ @_gRPC_FIND_PROTOBUF@ @_gRPC_FIND_SSL@ @_gRPC_FIND_CARES@ +find_package(upb CONFIG) # Targets include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake) diff --git a/cmake/upb.cmake b/cmake/upb.cmake index 2c0ab84..746e067 100644 --- a/cmake/upb.cmake +++ b/cmake/upb.cmake @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb) +find_package(upb REQUIRED) +set(_gRPC_UPB_INCLUDE_DIR) -set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}") set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-generated") -set(_gRPC_UPB_LIBRARIES upb) +set(_gRPC_UPB_LIBRARIES upb::upb)