allow using gRPC as a cmake subproject

pull/10517/head
Jan Tattermusch 8 years ago
parent b567bb4367
commit ecc457b43f
  1. 7
      CMakeLists.txt
  2. 7
      templates/CMakeLists.txt.template

@ -5,9 +5,6 @@
# This file can be regenerated from the template by running # This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh # tools/buildgen/generate_projects.sh
# #
# Additionally, this is currently very experimental, and unsupported.
# Further work will happen on that file.
#
# Copyright 2015, Google Inc. # Copyright 2015, Google Inc.
# All rights reserved. # All rights reserved.
# #
@ -308,7 +305,7 @@ function(protobuf_generate_grpc_cpp)
foreach(FIL ${ARGN}) foreach(FIL ${ARGN})
get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE) get_filename_component(FIL_WE ${FIL} NAME_WE)
file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${ABS_FIL}) file(RELATIVE_PATH REL_FIL ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL})
get_filename_component(REL_DIR ${REL_FIL} DIRECTORY) get_filename_component(REL_DIR ${REL_FIL} DIRECTORY)
set(RELFIL_WE "${REL_DIR}/${FIL_WE}") set(RELFIL_WE "${REL_DIR}/${FIL_WE}")
@ -324,7 +321,7 @@ function(protobuf_generate_grpc_cpp)
${_protobuf_include_path} ${_protobuf_include_path}
${REL_FIL} ${REL_FIL}
DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
VERBATIM) VERBATIM)

@ -7,9 +7,6 @@
# This file can be regenerated from the template by running # This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh # tools/buildgen/generate_projects.sh
# #
# Additionally, this is currently very experimental, and unsupported.
# Further work will happen on that file.
#
# Copyright 2015, Google Inc. # Copyright 2015, Google Inc.
# All rights reserved. # All rights reserved.
# #
@ -353,7 +350,7 @@
foreach(FIL <%text>${ARGN}</%text>) foreach(FIL <%text>${ARGN}</%text>)
get_filename_component(ABS_FIL <%text>${FIL}</%text> ABSOLUTE) get_filename_component(ABS_FIL <%text>${FIL}</%text> ABSOLUTE)
get_filename_component(FIL_WE <%text>${FIL}</%text> NAME_WE) get_filename_component(FIL_WE <%text>${FIL}</%text> NAME_WE)
file(RELATIVE_PATH REL_FIL <%text>${CMAKE_SOURCE_DIR}</%text> <%text>${ABS_FIL}</%text>) file(RELATIVE_PATH REL_FIL <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text> <%text>${ABS_FIL}</%text>)
get_filename_component(REL_DIR <%text>${REL_FIL}</%text> DIRECTORY) get_filename_component(REL_DIR <%text>${REL_FIL}</%text> DIRECTORY)
set(RELFIL_WE "<%text>${REL_DIR}/${FIL_WE}</%text>") set(RELFIL_WE "<%text>${REL_DIR}/${FIL_WE}</%text>")
@ -369,7 +366,7 @@
<%text>${_protobuf_include_path}</%text> <%text>${_protobuf_include_path}</%text>
<%text>${REL_FIL}</%text> <%text>${REL_FIL}</%text>
DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin
WORKING_DIRECTORY <%text>${CMAKE_SOURCE_DIR}</%text> WORKING_DIRECTORY <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text>
COMMENT "Running gRPC C++ protocol buffer compiler on <%text>${FIL}</%text>" COMMENT "Running gRPC C++ protocol buffer compiler on <%text>${FIL}</%text>"
VERBATIM) VERBATIM)

Loading…
Cancel
Save