cmake_modules/compilerchecks.cmake
changeset 9155 480f483de544
parent 9154 a43406054648
child 9156 6bf5359d5d14
--- a/cmake_modules/compilerchecks.cmake	Sat Jun 08 02:03:02 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Sat Jun 08 02:16:38 2013 +0200
@@ -4,6 +4,19 @@
 #when you need to check for a linker flag, just leave the argument of "check_c_compiler_flag" empty
 
 
+#stack protection
+check_c_compiler_flag("-fstack-protector" HAVE_STACKPROTECTOR)
+if(HAVE_STACKPROTECTOR)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
+endif()
+
+#symbol visibility
+check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITYH)
+if(HAVE_VISIBILITYH)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+endif()
+
+
 #check for noexecstack on ELF, Gentoo security
 set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack")
 check_c_compiler_flag("" HAVE_NOEXECSTACK)