This is an automated email from the ASF dual-hosted git repository.
lizhanhui pushed a commit to branch develop-cpp
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/develop-cpp by this push:
new 0d67c37b feat: explicitly control exported symbols
0d67c37b is described below
commit 0d67c37b1ae90e50b43d5d1088926ab79f3b4ab6
Author: Li Zhanhui <[email protected]>
AuthorDate: Fri Mar 22 23:57:11 2024 +0800
feat: explicitly control exported symbols
Signed-off-by: Li Zhanhui <[email protected]>
---
cpp/source/CMakeLists.txt | 3 +++
cpp/source/exports.map | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/cpp/source/CMakeLists.txt b/cpp/source/CMakeLists.txt
index d42c6a1a..dbf5ab01 100644
--- a/cpp/source/CMakeLists.txt
+++ b/cpp/source/CMakeLists.txt
@@ -53,7 +53,10 @@ target_link_libraries(rocketmq_shared
opencensus::stats
opencensus_proto
spdlog)
+set(VERSION_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/exports.map)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}
-Wl,--version-script=${VERSION_SCRIPT}")
set_target_properties(rocketmq_shared
PROPERTIES
+ LINK_DEPENDS ${VERSION_SCRIPT}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
LIBRARY_OUTPUT_NAME rocketmq)
\ No newline at end of file
diff --git a/cpp/source/exports.map b/cpp/source/exports.map
new file mode 100644
index 00000000..99ae5d1d
--- /dev/null
+++ b/cpp/source/exports.map
@@ -0,0 +1,6 @@
+{
+ global:
+ *rocketmq*;
+ local:
+ *;
+};
\ No newline at end of file