cmake_modules/compilerchecks.cmake
changeset 9339 14f5f3a1e2f7
parent 9315 15487f7fed42
child 10783 8e742c9ffdf8
--- a/cmake_modules/compilerchecks.cmake	Mon Jul 08 09:54:38 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Mon Jul 08 12:10:55 2013 +0200
@@ -20,9 +20,6 @@
     if(HAVE_STACKPROTECTOR)
         add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector")
         add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector")
-        add_flag_append(CMAKE_EXE_LINKER_FLAGS "-fstack-protector-all -fstack-protector")
-        add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-fstack-protector-all -fstack-protector")
-        add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fstack-protector-all -fstack-protector")
     endif()
 endif()
 
@@ -43,6 +40,13 @@
         add_linker_flag("-znoexecstack")
     endif()
 
+    #check for origin on ELF, BSD $ORIGIN support
+    set(CMAKE_REQUIRED_FLAGS "-Wl,-zorigin")
+    check_c_compiler_flag("" HAVE_ORIGIN)
+    if(HAVE_ORIGIN)
+        add_linker_flag("-zorigin")
+    endif()
+
     #check for full relro on ELF, Debian security
     set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow")
     check_c_compiler_flag("" HAVE_RELROFULL)