[cmake] Use CMake property for symbol visibility

CMake provides a target property to set default symbol visibility which
supports different toolchains transparently.
This commit is contained in:
Pedro Olsen Ferreira 2023-08-18 12:38:37 +01:00 committed by arcady-lunarg
parent 3805888a57
commit 98aa694422

View File

@ -234,10 +234,9 @@ endfunction()
function(glslang_only_export_explicit_symbols target) function(glslang_only_export_explicit_symbols target)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
target_compile_definitions(${target} PUBLIC "GLSLANG_IS_SHARED_LIBRARY=1") target_compile_definitions(${target} PUBLIC "GLSLANG_IS_SHARED_LIBRARY=1")
set_target_properties(${target} PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
if(WIN32) if(WIN32)
target_compile_definitions(${target} PRIVATE "GLSLANG_EXPORTING=1") target_compile_definitions(${target} PRIVATE "GLSLANG_EXPORTING=1")
else()
target_compile_options(${target} PRIVATE "-fvisibility=hidden")
endif() endif()
endif() endif()
endfunction() endfunction()