Hide symbols in cross platform manner

This commit is contained in:
Chris Thrasher 2022-05-17 21:03:12 -06:00 committed by Lukas Dürrenberger
parent 62d1abe491
commit 5fde1ca613

View File

@ -171,11 +171,10 @@ macro(sfml_add_library module)
endif() endif()
endif() endif()
# if using gcc or clang on a non-Windows platform, we must hide public symbols by default # ensure public symbols are hidden by default (exported ones are explicitly marked)
# (exported ones are explicitly marked) set_target_properties(${target} PROPERTIES
if(NOT SFML_OS_WINDOWS AND (SFML_COMPILER_GCC OR SFML_COMPILER_CLANG)) CXX_VISIBILITY_PRESET hidden
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden) VISIBILITY_INLINES_HIDDEN YES)
endif()
# build frameworks or dylibs # build frameworks or dylibs
if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS AND NOT THIS_STATIC) if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS AND NOT THIS_STATIC)