oops, haskell uses gcc to link, correctly pass flags
authorkoda
Wed, 12 Jun 2013 09:49:46 +0200
changeset 9207 16373565692a
parent 9206 4788b24fee05
child 9208 acb2492288e5
oops, haskell uses gcc to link, correctly pass flags
cmake_modules/compilerchecks.cmake
--- a/cmake_modules/compilerchecks.cmake	Wed Jun 12 01:30:16 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Wed Jun 12 09:49:46 2013 +0200
@@ -32,7 +32,7 @@
 check_c_compiler_flag("" HAVE_NOEXECSTACK)
 if(HAVE_NOEXECSTACK)
     list(APPEND pascal_flags "-k-z" "-knoexecstack")
-    list(APPEND haskell_flags "-optl" "-z" "-optl" "noexecstack")
+    list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 endif()
 
@@ -41,7 +41,7 @@
 check_c_compiler_flag("" HAVE_RELROFULL)
 if(HAVE_RELROFULL)
     list(APPEND pascal_flags "-k-z" "-krelro" "-k-z" "-know")
-    list(APPEND haskell_flags "-optl" "-z" "-optl" "relro" "-optl" "-z" "-optl" "now")
+    list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 else()
     #if full relro is not available, try partial relro
@@ -49,7 +49,7 @@
     check_c_compiler_flag("" HAVE_RELROPARTIAL)
     if(HAVE_RELROPARTIAL)
         list(APPEND pascal_flags "-k-z" "-krelro")
-        list(APPEND haskell_flags "-optl" "-z" "-optl" "relro")
+        list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
     endif()
 endif()
@@ -59,7 +59,7 @@
 check_c_compiler_flag("" HAVE_WINASLR)
 if(HAVE_WINASLR)
     list(APPEND pascal_flags "-k--nxcompat")
-    list(APPEND haskell_flags "-optl" "--nxcompat")
+    list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 endif()
 
@@ -68,7 +68,7 @@
 check_c_compiler_flag("" HAVE_WINDEP)
 if(HAVE_WINDEP)
     list(APPEND pascal_flags "-k--dynamicbase")
-    list(APPEND haskell_flags "-optl" "--dynamicbase")
+    list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 endif()
 
@@ -77,7 +77,7 @@
 check_c_compiler_flag("" HAVE_ASNEEDED)
 if(HAVE_ASNEEDED)
     list(APPEND pascal_flags "-k--as-needed")
-    list(APPEND haskell_flags "-optl" "--as-needed")
+    list(APPEND haskell_flags "-optl" "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 endif()