From 71f9a0069c752d1fc29234f3803321a56a01cff1 Mon Sep 17 00:00:00 2001 From: Joseph Eng Date: Wed, 27 Dec 2023 20:56:40 -0800 Subject: [PATCH] Try using EXPORT_MACRO --- wpimath/CMakeLists.txt | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/wpimath/CMakeLists.txt b/wpimath/CMakeLists.txt index 449f79d7cca..4d5735108d1 100644 --- a/wpimath/CMakeLists.txt +++ b/wpimath/CMakeLists.txt @@ -10,14 +10,25 @@ file(GLOB wpimath_proto_src src/main/proto/*.proto) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) add_library(wpimathproto ${wpimath_proto_src}) -protobuf_generate( - TARGET - wpimathproto - # EXPORT_MACRO? - PROTOC_OUT_DIR - "${CMAKE_CURRENT_BINARY_DIR}/protobuf" - APPEND_PATH -) +if(MSVC) + protobuf_generate( + TARGET + wpimathproto + EXPORT_MACRO + "__declspec(dllexport)" + PROTOC_OUT_DIR + "${CMAKE_CURRENT_BINARY_DIR}/protobuf" + APPEND_PATH + ) +else() + protobuf_generate( + TARGET + wpimathproto + PROTOC_OUT_DIR + "${CMAKE_CURRENT_BINARY_DIR}/protobuf" + APPEND_PATH + ) +endif() target_compile_features(wpimathproto PUBLIC cxx_std_14)