since shared libs are now our friends, let's optimise them
authorkoda
Wed, 12 Jun 2013 01:30:16 +0200
changeset 9206 4788b24fee05
parent 9205 abce6011f86c
child 9207 16373565692a
since shared libs are now our friends, let's optimise them
cmake_modules/compilerchecks.cmake
--- a/cmake_modules/compilerchecks.cmake	Wed Jun 12 01:26:42 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Wed Jun 12 01:30:16 2013 +0200
@@ -72,6 +72,14 @@
     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
 endif()
 
+#this is actually an optimisation
+set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed")
+check_c_compiler_flag("" HAVE_ASNEEDED)
+if(HAVE_ASNEEDED)
+    list(APPEND pascal_flags "-k--as-needed")
+    list(APPEND haskell_flags "-optl" "--as-needed")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
+endif()
 
 #always unset or these flags will be spread everywhere
 unset(CMAKE_REQUIRED_FLAGS)