cmake: Use GENERATE_EXTENSIONS parameter in protobuf_generate

parent b61dd9d9
...@@ -38,11 +38,11 @@ function(protobuf_generate) ...@@ -38,11 +38,11 @@ function(protobuf_generate)
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
endif() endif()
if(NOT protobuf_GENERATE_EXTENSIONS) if(NOT protobuf_generate_GENERATE_EXTENSIONS)
if(protobuf_generate_LANGUAGE STREQUAL cpp) if(protobuf_generate_LANGUAGE STREQUAL cpp)
set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc) set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc)
elseif(protobuf_generate_LANGUAGE STREQUAL python) elseif(protobuf_generate_LANGUAGE STREQUAL python)
set(protobuf_GENERATE_EXTENSIONS _pb2.py) set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py)
else() else()
message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
return() return()
...@@ -91,7 +91,7 @@ function(protobuf_generate) ...@@ -91,7 +91,7 @@ function(protobuf_generate)
get_filename_component(_basename ${_proto} NAME_WE) get_filename_component(_basename ${_proto} NAME_WE)
set(_generated_srcs) set(_generated_srcs)
foreach(_ext ${protobuf_GENERATE_EXTENSIONS}) foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}") list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}")
endforeach() endforeach()
list(APPEND _generated_srcs_all ${_generated_srcs}) list(APPEND _generated_srcs_all ${_generated_srcs})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment