Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc: fix cross-build + provide all CMake executable imported targets + add shared option + modernize #9044

Merged
merged 18 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion recipes/grpc/all/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.12)
project(cmake_wrapper)

include(conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(KEEP_RPATHS)

add_subdirectory("source_subfolder")
18 changes: 0 additions & 18 deletions recipes/grpc/all/cmake/grpc_cpp_plugin.cmake

This file was deleted.

31 changes: 31 additions & 0 deletions recipes/grpc/all/cmake/grpc_plugin_template.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
if(NOT TARGET @target_name@)
if(CMAKE_CROSSCOMPILING)
find_program(@find_program_variable@
NAMES @executable_name@
PATHS ENV PATH
NO_DEFAULT_PATH
)
else()
find_program(@find_program_variable@
NAMES @executable_name@
PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/"
NO_DEFAULT_PATH
)
endif()
# TODO: In conan v2 with CMakeToolchain, can be replaced by:
# find_program(@find_program_variable@ NAMES @executable_name@))
# # Nice enough to handle grpc not in build_requires for native build
# if(NOT @find_program_variable@ AND NOT CMAKE_CROSSCOMPILING)
# find_program(@find_program_variable@
# NAMES @executable_name@
# PATHS "${CMAKE_CURRENT_LIST_DIR}/@relative_path@bin/"
# NO_DEFAULT_PATH
# )
# endif()

if(@find_program_variable@)
get_filename_component(@find_program_variable@ "${@find_program_variable@}" ABSOLUTE)
add_executable(@target_name@ IMPORTED)
set_property(TARGET @target_name@ PROPERTY IMPORTED_LOCATION ${@find_program_variable@})
endif()
endif()
Loading