[autobuild] fix lua configure error handling
[lighttpd.git] / cmake / LighttpdMacros.cmake
blobf3356990ad216ed757e199adff555489abdb63a4
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                 add_library(${LIBNAME} SHARED ${SRCFILES})
9                 set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} ${LIBNAME})
10                 ## Windows likes to link it this way back to app!
11                 if(WIN32)
12                         set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS lighttpd.lib)
13                 endif()
15                 if(APPLE)
16                         set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
17                 endif()
18         endif()
19 endmacro(ADD_AND_INSTALL_LIBRARY)
21 macro(LEMON_PARSER SRCFILE)
22         get_filename_component(SRCBASE ${SRCFILE} NAME_WE)
23         add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.c ${CMAKE_CURRENT_BINARY_DIR}/${SRCBASE}.h
24                 COMMAND ${CMAKE_BINARY_DIR}/build/lemon
25                 ARGS -q ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
26                 DEPENDS ${CMAKE_BINARY_DIR}/build/lemon ${CMAKE_CURRENT_SOURCE_DIR}/${SRCFILE} ${CMAKE_SOURCE_DIR}/src/lempar.c
27                 COMMENT "Generating ${SRCBASE}.c from ${SRCFILE}"
28         )
29 endmacro(LEMON_PARSER)
31 macro(ADD_TARGET_PROPERTIES _target _name)
32         set(_properties)
33         foreach(_prop ${ARGN})
34                 set(_properties "${_properties} ${_prop}")
35         endforeach()
36         get_target_property(_old_properties ${_target} ${_name})
37         message("adding property to ${_target} ${_name}:" ${_properties})
38         if(NOT _old_properties)
39                 # in case it's NOTFOUND
40                 set(_old_properties)
41         endif()
42         set_target_properties(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
43 endmacro(ADD_TARGET_PROPERTIES)