I have been able to fix it by searching for the right grpc libraries in the 
recipe-sysroot:

find_library(GRPC_LIBRARY grpc++
HINTS
${CMAKE_SOURCE_DIR}/recipe- sysroot)

if (GRPC_LIBRARY-NOTFOUND)
message(FATAL_ERROR "Could not find grpc++")
endif ()

find_path(GRPC_INCLUDE_DIR grpc++/grpc++.h
HINTS
${CMAKE_SOURCE_DIR}/recipe- sysroot)

add_library(gRPC::grpc++ UNKNOWN IMPORTED)
set_target_properties(gRPC:: grpc++
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${GRPC_INCLUDE_DIR}")
set_target_properties(gRPC:: grpc++
PROPERTIES IMPORTED_LOCATION
"${GRPC_LIBRARY}")
set(GRPC_LIBRARIES gRPC::grpc++)

and then at the end add to link the found grpc library to your application:

target_link_libraries(${ PROJECT_NAME}
PRIVATE protobuf::libprotobuf
PRIVATE ${GRPC_LIBRARIES}
)

I haven't changed anything to my recipe, just that I added an environment 
setting which gets set as "YOCTO" to only execute this when it's being ran by 
Yocto. Can do less hard coding (setting the hint as ${CMAKE_SOURCE_DIR}/recipe- 
sysroot) by looking in CMAKE_SYSROOT.

This doesn't seem like an easy patch to add to gRPC. And since the issue, which 
I linked in my first post, got already closed without providing a real 
solution; it seems like the people at gRPC aren't really sure what is happening 
either.

Kind regards,
Goran Broeckaert
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#142433): 
https://lists.openembedded.org/g/openembedded-core/message/142433
Mute This Topic: https://lists.openembedded.org/mt/76731562/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to