cmake: Use GENERATE_EXTENSIONS parameter in protobuf_generate

This commit is contained in:
Christian von Arnim 2018-05-14 08:52:28 +02:00
parent b61dd9d9a2
commit e8ae76fbde
No known key found for this signature in database
GPG Key ID: 9A2235280DE78C51

View File

@ -38,11 +38,11 @@ function(protobuf_generate)
set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
endif()
if(NOT protobuf_GENERATE_EXTENSIONS)
if(NOT protobuf_generate_GENERATE_EXTENSIONS)
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)
set(protobuf_GENERATE_EXTENSIONS _pb2.py)
set(protobuf_generate_GENERATE_EXTENSIONS _pb2.py)
else()
message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS")
return()
@ -91,7 +91,7 @@ function(protobuf_generate)
get_filename_component(_basename ${_proto} NAME_WE)
set(_generated_srcs)
foreach(_ext ${protobuf_GENERATE_EXTENSIONS})
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}")
endforeach()
list(APPEND _generated_srcs_all ${_generated_srcs})