From 5fde1ca613b7c308b6155594e5d067b1a02f5179 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Tue, 17 May 2022 21:03:12 -0600 Subject: [PATCH] Hide symbols in cross platform manner --- cmake/Macros.cmake | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake index 40bc5591..b5ed3129 100644 --- a/cmake/Macros.cmake +++ b/cmake/Macros.cmake @@ -171,11 +171,10 @@ macro(sfml_add_library module) endif() endif() - # if using gcc or clang on a non-Windows platform, we must hide public symbols by default - # (exported ones are explicitly marked) - if(NOT SFML_OS_WINDOWS AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)) - set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden) - endif() + # ensure public symbols are hidden by default (exported ones are explicitly marked) + set_target_properties(${target} PROPERTIES + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN YES) # build frameworks or dylibs if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS AND NOT THIS_STATIC)