From 98aa6944221291a8fd1602f4916c60edf0814e06 Mon Sep 17 00:00:00 2001 From: Pedro Olsen Ferreira Date: Fri, 18 Aug 2023 12:38:37 +0100 Subject: [PATCH] [cmake] Use CMake property for symbol visibility CMake provides a target property to set default symbol visibility which supports different toolchains transparently. --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a4f322..c1e0b05e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,10 +234,9 @@ endfunction() function(glslang_only_export_explicit_symbols target) if(BUILD_SHARED_LIBS) target_compile_definitions(${target} PUBLIC "GLSLANG_IS_SHARED_LIBRARY=1") + set_target_properties(${target} PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden) if(WIN32) target_compile_definitions(${target} PRIVATE "GLSLANG_EXPORTING=1") - else() - target_compile_options(${target} PRIVATE "-fvisibility=hidden") endif() endif() endfunction()