[security] ensure gid != 0 if server.username set (fixes #2725)
[lighttpd.git] / cmake / LighttpdMacros.cmake
blob95cab8d987f2984c4735c703c5a9994fd2263636
1 ## our modules are without the "lib" prefix
3 macro(ADD_AND_INSTALL_LIBRARY LIBNAME SRCFILES)
4         if(BUILD_STATIC)
5                 add_library(${LIBNAME} STATIC ${SRCFILES})
6                 target_link_libraries(lighttpd ${LIBNAME})
7         else()
8                 if(APPLE)
9                         add_library(${LIBNAME} MODULE ${SRCFILES})
10                 else()
11                         add_library(${LIBNAME} SHARED ${SRCFILES})
12                 endif()
13                 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
14                 ## Windows likes to link it this way back to app!
15                 if(WIN32)
16                         set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
17                 endif()
19                 if(APPLE)
20                         set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
21                 endif()
22         endif()
23 endmacro(ADD_AND_INSTALL_LIBRARY)
25 macro(LEMON_PARSER SRCFILE)
26         get_filename_component(SRCBASE ${SRCFILE} NAME_WE)
27         add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h
28                 COMMAND ${CMAKE_BINARY_DIR}/build/lemon
29                 ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
30                 DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
31                 COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}"
32         )
33 endmacro(LEMON_PARSER)
35 macro(ADD_TARGET_PROPERTIES _target _name)
36         set(_properties)
37         foreach(_prop ${ARGN})
38                 set(_properties "${_properties} ${_prop}")
39         endforeach()
40         get_target_property(_old_properties ${_target} ${_name})
41         message("adding property to ${_target} ${_name}:" ${_properties})
42         if(NOT _old_properties)
43                 # in case it's NOTFOUND
44                 set(_old_properties)
45         endif()
46         set_target_properties(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
47 endmacro(ADD_TARGET_PROPERTIES)