Browse Source

[cmake] Add support for plugins

personal/stbuehler/wip
Stefan Bühler 14 years ago
parent
commit
2e830e5517
  1. 53
      cmake/LighttpdMacros.cmake
  2. 23
      src/CMakeLists.txt

53
cmake/LighttpdMacros.cmake

@ -1,33 +1,38 @@
## our modules are without the "lib" prefix
MACRO(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
IF(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} STATIC ${SRCFILES})
TARGET_LINK_LIBRARIES(lighttpd ${LIBNAME})
ELSE(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} SHARED ${SRCFILES})
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
## Windows likes to link it this way back to app!
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
ENDIF(WIN32)
IF(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} STATIC ${SRCFILES})
TARGET_LINK_LIBRARIES(lighttpd ${LIBNAME})
ELSE(BUILD_STATIC)
ADD_LIBRARY(${LIBNAME} SHARED ${SRCFILES})
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
IF(APPLE)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
ENDIF(APPLE)
ENDIF(BUILD_STATIC)
ADD_TARGET_PROPERTIES(${LIBNAME} LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(${LIBNAME} COMPILE_FLAGS ${COMMON_CFLAGS})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
## Windows likes to link it this way back to app!
IF(WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
ENDIF(WIN32)
IF(APPLE)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
ENDIF(APPLE)
ENDIF(BUILD_STATIC)
ENDMACRO(ADD_AND_INSTALL_LIBRARY)
MACRO(ADD_TARGET_PROPERTIES _target _name)
SET(_properties)
FOREACH(_prop ${ARGN})
SET(_properties "${_properties} ${_prop}")
ENDFOREACH(_prop)
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
SET(_properties)
FOREACH(_prop ${ARGN})
SET(_properties "${_properties} ${_prop}")
ENDFOREACH(_prop)
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
MESSAGE("adding property to ${_target} ${_name}:" ${_properties})
IF(NOT _old_properties)
# in case it's NOTFOUND
SET(_old_properties)
ENDIF(NOT _old_properties)
SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
IF(NOT _old_properties)
# in case it's NOTFOUND
SET(_old_properties)
ENDIF(NOT _old_properties)
SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
ENDMACRO(ADD_TARGET_PROPERTIES)

23
src/CMakeLists.txt

@ -25,7 +25,7 @@ OPTION(BUILD_STATIC "build a static lighttpd with all modules added")
IF(BUILD_STATIC)
SET(LIGHTTPD_STATIC 1)
ELSE(BUILD_STATIC)
SET(CMAKE_SHARED_LIBRARY_PREFIX "")
SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
ENDIF(BUILD_STATIC)
CHECK_INCLUDE_FILES(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
@ -329,16 +329,19 @@ ADD_EXECUTABLE(lighttpd
)
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
SET(COMMON_LDFLAGS "${LUA_LDFLAGS} ${EV_LDFLAGS} ${GTHREAD_LDFLAGS} ${GMODULE_LDFLAGS}")
SET(COMMON_CFLAGS "${LUA_CFLAGS} ${EV_CFLAGS} ${GTHREAD_CFLAGS} ${GMODULE_CFLAGS}")
ADD_AND_INSTALL_LIBRARY(mod_fortune "modules/mod_fortune.c")
ADD_AND_INSTALL_LIBRARY(mod_status "modules/mod_status.c")
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${COMMON_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${COMMON_CFLAGS})
IF(HAVE_PCRE_H)
TARGET_LINK_LIBRARIES(lighttpd ${PCRE_LIBRARY})
ENDIF(HAVE_PCRE_H)
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${LUA_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${LUA_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${EV_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${EV_CFLAGS})
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
@ -347,12 +350,6 @@ IF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${GTHREAD_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${GTHREAD_CFLAGS})
ADD_TARGET_PROPERTIES(lighttpd LINK_FLAGS ${GMODULE_LDFLAGS})
ADD_TARGET_PROPERTIES(lighttpd COMPILE_FLAGS ${GMODULE_CFLAGS})
SET_TARGET_PROPERTIES(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
IF(WIN32)

Loading…
Cancel
Save