From b6e254a1cbcf4da67f8e545f29d74e500c535fb3 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 28 Dec 2023 10:59:31 -0800 Subject: [PATCH] build: hoist the C visibility settings to top level These settings are applied globally, hoist them to the top level of the project to make them easier to spot. --- CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e8f8e8fd..985960622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,10 @@ if(NOT MSVC) set(CMAKE_C_EXTENSIONS NO) endif() +# -fvisibility=hidden +set(CMAKE_C_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + set(CMAKE_INCLUDE_CURRENT_DIR ON) # The Linux modules distributed with CMake add "-rdynamic" to the build flags diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a234d6b98..aedadfa7c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -59,10 +59,6 @@ elseif (CMARK_SHARED) target_link_libraries(${PROGRAM} ${LIBRARY}) endif() -# -fvisibility=hidden -set(CMAKE_C_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) - if (CMARK_SHARED) add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES}) cmark_add_compile_options(${LIBRARY})