Skip to content

Commit

Permalink
Fix grpc lib order to support static libs
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed Jan 21, 2022
1 parent ecb7160 commit 9016536
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmake/Modules/FindgRPC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,16 @@ if(gRPC_USE_STATIC_LIBS)
endif()
endif()

find_library(gpr_LIBRARY NAMES gpr)
find_library(gRPC_LIBRARY NAMES grpc)
find_library(gRPC_CPP_LIBRARY NAMES grpc++)
find_library(gRPC_UNSECURE_LIBRARY NAMES grpc_unsecure)
find_library(gRPC_CPP_UNSECURE_LIBRARY NAMES grpc++_unsecure)
find_library(gRPC_CARES_LIBRARY NAMES cares)
find_library(gRPC_GPR_LIBRARY NAMES gpr)
find_library(gRPC_ADDRESS_SORTING_LIBRARY NAMES address_sorting)
find_library(gRPC_UPB_LIBRARY NAMES upb)

set(gRPC_LIBRARIES ${gpr_LIBRARY})
set(gRPC_LIBRARIES)
if(gRPC_USE_UNSECURE_LIBRARIES)
if(gRPC_UNSECURE_LIBRARY)
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_UNSECURE_LIBRARY})
Expand All @@ -266,7 +268,7 @@ else()
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_CPP_LIBRARY})
endif()
endif()
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_CARES_LIBRARY})
set(gRPC_LIBRARIES ${gRPC_LIBRARIES} ${gRPC_CARES_LIBRARY} ${gRPC_GPR_LIBRARY} ${gRPC_ADDRESS_SORTING_LIBRARY} ${gRPC_UPB_LIBRARY})

# Restore the original find library ordering.
if(gRPC_USE_STATIC_LIBS)
Expand Down

0 comments on commit 9016536

Please sign in to comment.