From 9d2227cf5c70f942e068457df546f53f1d44cc4c Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 22 Aug 2025 18:46:21 +0100 Subject: [PATCH] Add -fvisibility=hidden to GCC/Clang compiler flags --- cmake/compilers/gnu.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/compilers/gnu.cmake b/cmake/compilers/gnu.cmake index 22238f44..a6c9f934 100644 --- a/cmake/compilers/gnu.cmake +++ b/cmake/compilers/gnu.cmake @@ -24,6 +24,10 @@ add_compile_options(-Wno-format-zero-length -Wno-format-nonliteral) # that rely on the compiler not optimising them away, so disable it add_compile_options(-fno-strict-aliasing) +# This is necessary to hide all symbols unless explicitly exported +# via the Q_EXPORT macro +add_compile_options(-fvisibility=hidden) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX /opt/quake3) endif()