summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPino Toscano <pino@kde.org>2010-03-20 14:08:58 +0100
committerPino Toscano <pino@kde.org>2010-03-20 14:12:43 +0100
commit223bce6d14e632f457a81b2ec091fe16369d2eb6 (patch)
tree22de22db5fb7ceb2119baaef13b2f4ab22118cb8 /cmake
parentfc761f0d385708daaef1b95968532795b04f11b0 (diff)
[CMake] with GCC, pass --as-needed and --no-add-needed to the linker
--as-needed allows to avoid overlinking, linking only to the libraries whose symbols are actually used --no-add-needed makes the linker not use the NEEDED libraries automatically, so we have to always make sure we specify all the libraries actually used in a exe/lib
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/PopplerMacros.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index 0495777f..037f0fd0 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -107,6 +107,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed -Wl,--no-add-needed")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed -Wl,--no-add-needed")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -Wl,--no-add-needed")
endif (CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_C_COMPILER MATCHES "icc")