MATH( EXPR LIBZYPP_SO_FIRST "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" )
SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" )
-SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g -Wall -Woverloaded-virtual -Wnon-virtual-dtor" )
-SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g -Wall" )
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g -Wall -Woverloaded-virtual -Wnon-virtual-dtor -Wl,-as-needed" )
+SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g -Wall -Wl,-as-needed" )
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" )
ADD_LIBRARY(zypp SHARED ${zypp_lib_SRCS})
SET_TARGET_PROPERTIES( zypp PROPERTIES VERSION "${LIBZYPP_VERSION_INFO}" )
SET_TARGET_PROPERTIES( zypp PROPERTIES SOVERSION "${LIBZYPP_SOVERSION_INFO}" )
+SET_TARGET_PROPERTIES( zypp PROPERTIES LINK_FLAGS "--as-needed" )
ADD_DEPENDENCIES(zypp schema_header)
# System libraries
SET(UTIL_LIBRARY util)