adentinger / CMakeBestPractices

A reference CMake configuration for fairly scalable open-/closed-source C/C++ projects
MIT License
2 stars 0 forks source link

Hide symbols on *nix in shared libs #106

Open adentinger opened 5 months ago

adentinger commented 5 months ago

We could define the <lib>_SHRSYM macros to __attribute__ ((visibility ("default"))) for GCC and Clang. We could also define a <lib>_PRIV_SYM macro which is defined to __attribute__((__visibility__("hidden"))) on both Clang and GCC.

Then we could add -fvisibility=hidden to Clang and GCC to hide symbols by default, like for Windows.