aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/protobuf-config.cmake.in
diff options
context:
space:
mode:
authorGravatar Markus Heß <hessi88@googlemail.com>2017-09-22 11:44:59 +0200
committerGravatar Markus Heß <hessi88@googlemail.com>2017-09-22 11:44:59 +0200
commit9829b8f5115137936a2d2e7ed324954d32a5c127 (patch)
tree89847c5f4ad640bacec5995b42a411ece4d4cc0c /cmake/protobuf-config.cmake.in
parentc627530946e5d8783c1d9c2bbeb1704e4e868963 (diff)
protobuf_generate: add EXPORT_MACRO option
Diffstat (limited to 'cmake/protobuf-config.cmake.in')
-rw-r--r--cmake/protobuf-config.cmake.in8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in
index 11a9b75a..41ab5095 100644
--- a/cmake/protobuf-config.cmake.in
+++ b/cmake/protobuf-config.cmake.in
@@ -11,7 +11,7 @@ function(protobuf_generate)
include(CMakeParseArguments)
set(_options APPEND_PATH)
- set(_singleargs LANGUAGE OUT_VAR)
+ set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO)
if(COMMAND target_sources)
list(APPEND _singleargs TARGET)
endif()
@@ -34,6 +34,10 @@ function(protobuf_generate)
endif()
string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE)
+ if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
+ set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
+ endif()
+
if(NOT protobuf_GENERATE_EXTENSIONS)
if(protobuf_generate_LANGUAGE STREQUAL cpp)
set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc)
@@ -95,7 +99,7 @@ function(protobuf_generate)
add_custom_command(
OUTPUT ${_generated_srcs}
COMMAND protobuf::protoc
- ARGS --${protobuf_generate_LANGUAGE}_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file}
+ ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file}
DEPENDS ${ABS_FIL} protobuf::protoc
COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}"
VERBATIM )