Skip to content

Commit

Permalink
build: hoist the C visibility settings to top level
Browse files Browse the repository at this point in the history
These settings are applied globally, hoist them to the top level of the
project to make them easier to spot.
  • Loading branch information
compnerd authored and jgm committed Jan 4, 2024
1 parent ecf36ab commit b6e254a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit b6e254a

Please sign in to comment.