[cmake] fix linker errors with --as-needed (fixes #2360)

personal/stbuehler/wip
Stefan Bühler 11 years ago
parent f98f9bb7b3
commit b15ec2ecf4
  1. 15
      src/CMakeLists.txt

@ -315,7 +315,6 @@ SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd2-worker lighttpd2 lighttpd-$
IF(BUILD_EXTRA_WARNINGS)
SET(WARN_CFLAGS "-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith")
SET(WARN_LDFLAGS "-g -O2 -g2 -Wall -Wl,--as-needed")
SET(WARN_LDFLAGS "-g -O2 -g2 -Wall")
# -Werror -Wbad-function-cast -Wmissing-prototypes
ELSE(BUILD_EXTRA_WARNINGS)
SET(WARN_CFLAGS "")
@ -350,7 +349,7 @@ ADD_AND_INSTALL_LIBRARY(mod_vhost "modules/mod_vhost.c")
IF(HAVE_ZLIB OR HAVE_BZIP)
ADD_AND_INSTALL_LIBRARY(mod_deflate "modules/mod_deflate.c")
ADD_TARGET_PROPERTIES(mod_deflate LINK_FLAGS ${BZIP_LDFLAGS} ${ZLIB_LDFLAGS})
TARGET_LINK_LIBRARIES(mod_deflate ${BZIP_LDFLAGS} ${ZLIB_LDFLAGS})
ADD_TARGET_PROPERTIES(mod_deflate COMPILE_FLAGS ${BZIP_CFLAGS} ${ZLIB_CFLAGS})
ENDIF(HAVE_ZLIB OR HAVE_BZIP)
@ -364,19 +363,19 @@ IF(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
TARGET_LINK_LIBRARIES(mod_openssl crypto)
ENDIF(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-common LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(lighttpd-${PACKAGE_VERSION}-common ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-common COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-shared LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(lighttpd-${PACKAGE_VERSION}-shared ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-shared COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-sharedangel LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(lighttpd-${PACKAGE_VERSION}-sharedangel ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-${PACKAGE_VERSION}-sharedangel COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd2-worker LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(lighttpd2-worker ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd2-worker COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd2 LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(lighttpd2 ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd2 COMPILE_FLAGS ${COMMON_CFLAGS})
IF(HAVE_LIBCRYPT)
@ -429,7 +428,7 @@ IF(BUILD_UNIT_TESTS)
MACRO(ADD_TEST_BINARY TESTNAME EXENAME SRCFILES)
ADD_EXECUTABLE(${EXENAME} ${SRCFILES})
ADD_TARGET_PROPERTIES(${EXENAME} LINK_FLAGS ${COMMON_LDFLAGS})
TARGET_LINK_LIBRARIES(${EXENAME} ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(${EXENAME} COMPILE_FLAGS ${COMMON_CFLAGS})
TARGET_LINK_LIBRARIES(${EXENAME} lighttpd-${PACKAGE_VERSION}-common lighttpd-${PACKAGE_VERSION}-shared)

Loading…
Cancel
Save