From 085d5db0920066af2fcf68688d1563fe5d8ff1fb Mon Sep 17 00:00:00 2001 From: Yongqiang Tian Date: Wed, 16 Sep 2026 03:04:04 +0000 Subject: [PATCH] cmake: apply static API visibility to shared library The ZSTDLIB_STATIC_API and ZDICTLIB_STATIC_API cache settings are currently applied only to libzstd_static. Setting them to hidden therefore leaves static-only APIs exported from libzstd_shared. Apply the existing definitions to the shared target as well so the documented visibility controls affect the library for which symbol hiding matters. Signed-off-by: Yongqiang Tian --- build/cmake/lib/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index 82f4f50869c..51f7e97cb87 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -135,6 +135,8 @@ if (ZSTD_BUILD_SHARED) add_definition(libzstd_shared ZSTDLIB_VISIBLE) add_definition(libzstd_shared ZSTDERRORLIB_VISIBLE) add_definition(libzstd_shared ZDICTLIB_VISIBLE) + add_definition(libzstd_shared ZSTDLIB_STATIC_API) + add_definition(libzstd_shared ZDICTLIB_STATIC_API) endif () if (ZSTD_BUILD_STATIC) add_library(libzstd_static STATIC ${Sources} ${Headers})