1cmake_minimum_required(VERSION 3.5) 2 3set(PROTO_COMPILER "protoc") 4set(PROTO_C_COMPILER "protoc-c") 5set(C_OUT_PATH "${CMAKE_CURRENT_LIST_DIR}/../proto-c") 6set(PY_OUT_PATH "${CMAKE_CURRENT_LIST_DIR}/../python") 7 8set(PROTO_SRCS "constants.proto" 9 "sec0.proto" 10 "sec1.proto" 11 "session.proto") 12 13add_custom_target(c_proto 14 COMMAND ${PROTO_C_COMPILER} --c_out=${C_OUT_PATH} -I . ${PROTO_SRCS} 15 VERBATIM 16 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 17 ) 18 19add_custom_target(python_proto 20 COMMAND ${PROTO_COMPILER} --python_out=${PY_OUT_PATH} -I . ${PROTO_SRCS} 21 VERBATIM 22 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 23 ) 24 25add_custom_target(proto ALL 26 DEPENDS c_proto python_proto 27 VERBATIM 28 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} 29 ) 30