From f485424f7f8bb781ae3556684d763d0e7730f84a Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 9 Mar 2015 09:49:55 +0100 Subject: [PATCH] Add -fvisibility-inlines-hidden to the C/CXX flags when available --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f32aeefc..1ef5d5733 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() -- 2.40.0