Skip to content

Commit

Permalink
Hide C symbols in CMake build by default (facebook#1045)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1045

We currently only hide C++ symbols, but we should hide symbols from C
source files as well.

Reviewed By: fbmal7

Differential Revision: D47160437

fbshipit-source-id: d4fd22f024bde892ed4180528cd71f45370f031b
  • Loading branch information
neildhar authored and facebook-github-bot committed Jun 30, 2023
1 parent 28e1a33 commit 19e65be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ endif()

if (GCC_COMPATIBLE)
# Don't export symbols unless we explicitly say so
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
append("-fvisibility=hidden" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# C4068 unknown pragma
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4068")
Expand Down

0 comments on commit 19e65be

Please sign in to comment.