Add -fvisibility-inlines-hidden to the C/CXX flags when available

This commit is contained in:
Gunnar Beutner 2015-03-09 09:49:55 +01:00
parent 4e16f48255
commit f485424f7f
1 changed files with 9 additions and 0 deletions

View File

@ -147,6 +147,15 @@ if(ICINGA2_LTO_BUILD)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto")
endif()
include(CheckCCompilerFlag)
check_c_compiler_flag(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN)
if(HAVE_VISIBILITY_INLINES_HIDDEN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility-inlines-hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
endif()