Build: Default symbol visibility to hidden

This commit is contained in:
Connor McLaughlin 2021-06-04 13:14:22 +10:00
parent 262c43ac00
commit 02f75f25d3

View file

@ -223,6 +223,15 @@ if(MSVC)
endif()
# Default symbol visibility to hidden, that way we don't go through the PLT for intra-library calls.
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-semantic-interposition")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-semantic-interposition")
endif()
# Detect C++ version support.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)