cmake_modules/compilerchecks.cmake
changeset 9165 7b0d5388abc4
parent 9159 3e9d4bbc4053
child 9167 ecf19179b37e
--- a/cmake_modules/compilerchecks.cmake	Thu Jun 06 15:55:10 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Mon Jun 10 10:47:59 2013 +0200
@@ -5,15 +5,18 @@
 
 # CMAKE_C{XX}_FLAGS is for compiler flags (c and c++)
 # CMAKE_EXE_LINKER_FLAGS is for linker flags (also add them to pascal_flags and haskell_flags)
-
+# CMAKE_SHARED_LIBRARY_<lang>_FLAGS same but for shared libraries
 
 #TODO: should there be two different checks for C and CXX?
 
-#stack protection
+#stack protection, when found it needs to go in the linker flags too (-lssp is added)
 check_c_compiler_flag("-fstack-protector" HAVE_STACKPROTECTOR)
 if(HAVE_STACKPROTECTOR)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector")
+    set(CMAKE_SHARED_LIBRARY_C_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
+    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
 endif()
 
 #symbol visibility