Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
c2044022
Commit
c2044022
authored
Sep 22, 2017
by
Feng Xiao
Committed by
GitHub
Sep 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3675 from hesmar/hesmar/cmakeAddDllExport
protobuf_generate: add EXPORT_MACRO option
parents
c6275309
9829b8f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
protobuf-config.cmake.in
cmake/protobuf-config.cmake.in
+6
-2
protobuf-module.cmake.in
cmake/protobuf-module.cmake.in
+5
-2
No files found.
cmake/protobuf-config.cmake.in
View file @
c2044022
...
...
@@ -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 )
...
...
cmake/protobuf-module.cmake.in
View file @
c2044022
...
...
@@ -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 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
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})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment