|
|
@ -164,6 +164,17 @@ |
|
|
|
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf") |
|
|
|
set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC) |
|
|
|
|
|
|
|
# C core has C++ source code, but should not depend on libstc++ (for better portability). |
|
|
|
|
|
|
|
# We need to use a few tricks to convince cmake to do that. |
|
|
|
|
|
|
|
# https://stackoverflow.com/questions/15058403/how-to-stop-cmake-from-linking-against-libstdc |
|
|
|
|
|
|
|
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") |
|
|
|
|
|
|
|
# Exceptions and RTTI must be off to avoid dependency on libstdc++ |
|
|
|
|
|
|
|
set(_gRPC_CORE_NOSTDCXX_FLAGS -fno-exceptions -fno-rtti) |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
set(_gRPC_CORE_NOSTDCXX_FLAGS "") |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
include(cmake/zlib.cmake) |
|
|
|
include(cmake/zlib.cmake) |
|
|
|
include(cmake/cares.cmake) |
|
|
|
include(cmake/cares.cmake) |
|
|
|
include(cmake/protobuf.cmake) |
|
|
|
include(cmake/protobuf.cmake) |
|
|
@ -403,7 +414,14 @@ |
|
|
|
PRIVATE <%text>${_gRPC_PROTO_GENS_DIR}</%text> |
|
|
|
PRIVATE <%text>${_gRPC_PROTO_GENS_DIR}</%text> |
|
|
|
% endif |
|
|
|
% endif |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
% if lib.language in ['c', 'csharp']: |
|
|
|
|
|
|
|
# avoid dependency on libstdc++ |
|
|
|
|
|
|
|
if (_gRPC_CORE_NOSTDCXX_FLAGS) |
|
|
|
|
|
|
|
set_target_properties(${lib.name} PROPERTIES LINKER_LANGUAGE C) |
|
|
|
|
|
|
|
# only use the flags for C++ source files |
|
|
|
|
|
|
|
target_compile_options(${lib.name} PRIVATE <%text>$<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}></%text>) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
% endif |
|
|
|
% if len(get_deps(lib)) > 0: |
|
|
|
% if len(get_deps(lib)) > 0: |
|
|
|
target_link_libraries(${lib.name} |
|
|
|
target_link_libraries(${lib.name} |
|
|
|
% for dep in get_deps(lib): |
|
|
|
% for dep in get_deps(lib): |
|
|
@ -492,6 +510,14 @@ |
|
|
|
${dep} |
|
|
|
${dep} |
|
|
|
% endfor |
|
|
|
% endfor |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% if tgt.language in ['c', 'csharp']: |
|
|
|
|
|
|
|
# avoid dependency on libstdc++ |
|
|
|
|
|
|
|
if (_gRPC_CORE_NOSTDCXX_FLAGS) |
|
|
|
|
|
|
|
set_target_properties(${tgt.name} PROPERTIES LINKER_LANGUAGE C) |
|
|
|
|
|
|
|
target_compile_options(${tgt.name} PRIVATE <%text>$<$<COMPILE_LANGUAGE:CXX>:${_gRPC_CORE_NOSTDCXX_FLAGS}></%text>) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
% endif |
|
|
|
% endif |
|
|
|
% endif |
|
|
|
</%def> |
|
|
|
</%def> |
|
|
|
|
|
|
|
|
|
|
|