Browse Source

cmake: put everything except main() into shared libraries

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent
commit
c735d9a4b6
  1. 7
      cmake/LighttpdMacros.cmake
  2. 26
      src/CMakeLists.txt

7
cmake/LighttpdMacros.cmake

@ -12,12 +12,7 @@ MACRO(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
ADD_TARGET_PROPERTIES(${LIBNAME} COMPILE_FLAGS ${COMMON_CFLAGS})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
TARGET_LINK_LIBRARIES(${LIBNAME} lighttpd-common)
## Windows likes to link it this way back to app!
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
ENDIF(WIN32)
TARGET_LINK_LIBRARIES(${LIBNAME} lighttpd-common lighttpd-shared)
IF(APPLE)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")

26
src/CMakeLists.txt

@ -249,19 +249,27 @@ ADD_LIBRARY(lighttpd-common SHARED
${COMMON_SRC}
)
ADD_LIBRARY(lighttpd-shared SHARED
${LIGHTTPD_SHARED_SRC}
)
TARGET_LINK_LIBRARIES(lighttpd-shared lighttpd-common)
ADD_LIBRARY(lighttpd-sharedangel SHARED
${ANGEL_SHARED_SRC}
)
TARGET_LINK_LIBRARIES(lighttpd-sharedangel lighttpd-common)
ADD_EXECUTABLE(lighttpd
main/lighttpd.c
${LIGHTTPD_SHARED_SRC}
)
TARGET_LINK_LIBRARIES(lighttpd lighttpd-common)
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
TARGET_LINK_LIBRARIES(lighttpd lighttpd-common lighttpd-shared)
ADD_EXECUTABLE(lighttpd-angel
angel/angel_main.c
${ANGEL_SHARED_SRC}
)
TARGET_LINK_LIBRARIES(lighttpd-angel lighttpd-common)
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd-angel)
TARGET_LINK_LIBRARIES(lighttpd-angel lighttpd-common lighttpd-sharedangel)
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd lighttpd-angel lighttpd-common lighttpd-shared lighttpd-sharedangel)
IF(BUILD_EXTRA_WARNINGS)
SET(WARN_CFLAGS "-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith")
@ -308,6 +316,12 @@ ENDIF(HAVE_LIBSSL AND HAVE_LIBCRYPTO)
ADD_TARGET_PROPERTIES(lighttpd-common LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-common COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-shared LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-shared COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-sharedangel LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd-sharedangel COMPILE_FLAGS ${COMMON_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${COMMON_CFLAGS})

Loading…
Cancel
Save