protobuf_generate: add EXPORT_MACRO option
diff --git a/cmake/protobuf-module.cmake.in b/cmake/protobuf-module.cmake.in
index 8e4920a..2e7c021 100644
--- a/cmake/protobuf-module.cmake.in
+++ b/cmake/protobuf-module.cmake.in
@@ -2,7 +2,10 @@
# Functions
function(PROTOBUF_GENERATE_CPP SRCS HDRS)
- if(NOT ARGN)
+ cmake_parse_arguments(protobuf_generate_cpp "" "EXPORT_MACRO" "" ${ARGN})
+
+ set(_proto_files "${protobuf_generate_cpp_UNPARSED_ARGUMENTS}")
+ if(NOT _proto_files)
message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files")
return()
endif()
@@ -16,7 +19,7 @@
endif()
set(_outvar)
- protobuf_generate(${append_arg} LANGUAGE cpp OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN})
+ protobuf_generate(${append_arg} LANGUAGE cpp EXPORT_MACRO ${protobuf_generate_cpp_EXPORT_MACRO} OUT_VAR _outvar ${_import_arg} PROTOS ${_proto_files})
set(${SRCS})
set(${HDRS})