]> granicus.if.org Git - icinga2/commitdiff
Add -fvisibility-inlines-hidden to the C/CXX flags when available
authorGunnar Beutner <gunnar@beutner.name>
Mon, 9 Mar 2015 08:49:55 +0000 (09:49 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Mon, 9 Mar 2015 08:49:55 +0000 (09:49 +0100)
CMakeLists.txt

index 0f32aeefcba7be1bbcf7514a40009d4b688b1fcb..1ef5d5733e183d479a6f01f34450c633ebbdc2f1 100644 (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()