diff --git a/CMakeLists.txt b/CMakeLists.txt index b2f6b61c..df2513d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,11 @@ if(SPDLOG_BUILD_PIC) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() +if((${CMAKE_POSITION_INDEPENDENT_CODE}) OR (${CMAKE_CXX_FLAGS} MATCHES "-fPIC")) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) + set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) +endif() + find_package(Threads REQUIRED) message(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) # ---------------------------------------------------------------------------------------