Files
nearby/cmake/proto_defs.cmake
T
Alexey Polyudov 7466db88c0 Add CMake support
Change-Id: I716e1fa3ec43bfe57326f5a691131505f84b7832
2020-04-04 12:55:01 -07:00

29 lines
544 B
CMake

function(add_cc_proto_library NAME)
set(single)
set(multi_args PROTOS INCS DEPS)
cmake_parse_arguments(PARSE_ARGV 1 args "" "${single}" "${multi_args}")
protobuf_generate(
PROTOS ${args_PROTOS}
LANGUAGE cpp
OUT_VAR ${NAME}_var
)
add_library(${NAME}
${${NAME}_var}
)
target_link_libraries(${NAME}
PUBLIC
${Protobuf_LIBRARIES}
${args_DEPS}
)
target_include_directories(${NAME}
PUBLIC
${Protobuf_INCLUDE_DIRS}
${args_INCS}
${CMAKE_CURRENT_BINARY_DIR}
)
endfunction()