From 5fe6157d87cb9af4d8548960d45dac8835db2860 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 18 Apr 2021 10:34:01 +0200 Subject: [PATCH] CMake: hide all the symbols by default Hide all the symbols that are not explicitly exported with YAML_CPP_API. This way the ABI will be way smaller, and only actually exposing the public classes/functions. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 912b09b..73fd8e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,10 @@ include(GNUInstallDirs) include(CTest) include(GenerateExportHeader) +set(CMAKE_C_VISIBILITY_PRESET hidden) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + find_program(YAML_CPP_CLANG_FORMAT_EXE NAMES clang-format) option(YAML_CPP_BUILD_CONTRIB "Enable yaml-cpp contrib in library" ON)