This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new b2fbbb5  fix: shared library uses hidden visibility by default (#338)
b2fbbb5 is described below

commit b2fbbb5df62e1411424a8eb75889fa1b48e36021
Author: Zehua Zou <[email protected]>
AuthorDate: Fri Nov 21 16:16:33 2025 +0800

    fix: shared library uses hidden visibility by default (#338)
---
 cmake_modules/IcebergBuildUtils.cmake | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cmake_modules/IcebergBuildUtils.cmake 
b/cmake_modules/IcebergBuildUtils.cmake
index edcb1d9..99f57d9 100644
--- a/cmake_modules/IcebergBuildUtils.cmake
+++ b/cmake_modules/IcebergBuildUtils.cmake
@@ -152,6 +152,10 @@ function(add_iceberg_lib LIB_NAME)
 
     string(TOUPPER ${LIB_NAME} VISIBILITY_NAME)
     target_compile_definitions(${LIB_NAME}_shared PRIVATE 
${VISIBILITY_NAME}_EXPORTING)
+    set_target_properties(${LIB_NAME}_shared
+                          PROPERTIES C_VISIBILITY_PRESET hidden 
CXX_VISIBILITY_PRESET
+                                                                hidden
+                                     VISIBILITY_INLINES_HIDDEN 1)
 
     install(TARGETS ${LIB_NAME}_shared
             EXPORT iceberg_targets
@@ -211,8 +215,10 @@ function(add_iceberg_lib LIB_NAME)
     target_link_libraries(${LIB_NAME}_static
                           PUBLIC "$<BUILD_INTERFACE:iceberg_sanitizer_flags>")
 
-    string(TOUPPER ${LIB_NAME} VISIBILITY_NAME)
-    target_compile_definitions(${LIB_NAME}_static PUBLIC 
${VISIBILITY_NAME}_STATIC)
+    if(WIN32)
+      string(TOUPPER ${LIB_NAME} VISIBILITY_NAME)
+      target_compile_definitions(${LIB_NAME}_static PUBLIC 
${VISIBILITY_NAME}_STATIC)
+    endif()
 
     install(TARGETS ${LIB_NAME}_static
             EXPORT iceberg_targets

Reply via email to