[icinga-checkins] icinga.org: icinga2/master: Add -fvisibility= hidden to the default compiler flags

git at icinga.org git at icinga.org
Thu Aug 25 07:10:54 CEST 2016


Module: icinga2
Branch: master
Commit: 376e83bd0640a9f6780aa1d0987808e848e36569
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=376e83bd0640a9f6780aa1d0987808e848e36569

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Aug 25 05:05:51 2016 +0200

Add -fvisibility=hidden to the default compiler flags

fixes #12536

---

 CMakeLists.txt |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19ad6f2..8921b20 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -194,6 +194,13 @@ if(HAVE_VISIBILITY_INLINES_HIDDEN)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
 endif()
 
+check_c_compiler_flag(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN)
+
+if(HAVE_VISIBILITY_HIDDEN)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+endif()
+
 if(MSVC)
   add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
 endif()



More information about the icinga-checkins mailing list