Skip to content

Commit 71f9a00

Browse files
committed
Try using EXPORT_MACRO
1 parent 6069560 commit 71f9a00

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

wpimath/CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,25 @@ file(GLOB wpimath_proto_src src/main/proto/*.proto)
1010
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
1111
add_library(wpimathproto ${wpimath_proto_src})
1212

13-
protobuf_generate(
14-
TARGET
15-
wpimathproto
16-
# EXPORT_MACRO?
17-
PROTOC_OUT_DIR
18-
"${CMAKE_CURRENT_BINARY_DIR}/protobuf"
19-
APPEND_PATH
20-
)
13+
if(MSVC)
14+
protobuf_generate(
15+
TARGET
16+
wpimathproto
17+
EXPORT_MACRO
18+
"__declspec(dllexport)"
19+
PROTOC_OUT_DIR
20+
"${CMAKE_CURRENT_BINARY_DIR}/protobuf"
21+
APPEND_PATH
22+
)
23+
else()
24+
protobuf_generate(
25+
TARGET
26+
wpimathproto
27+
PROTOC_OUT_DIR
28+
"${CMAKE_CURRENT_BINARY_DIR}/protobuf"
29+
APPEND_PATH
30+
)
31+
endif()
2132

2233
target_compile_features(wpimathproto PUBLIC cxx_std_14)
2334

0 commit comments

Comments
 (0)