[cmake] fix macros, glib2 including and libev cflags

This commit is contained in:
Stefan Bühler 2013-07-20 10:47:34 +02:00
parent 64c505e3c7
commit ef2ff3f599
2 changed files with 13 additions and 15 deletions

View File

@ -23,8 +23,7 @@ FIND_PACKAGE(LibEV REQUIRED)
# GLIB 2 # GLIB 2
pkg_check_modules (GLIB2 REQUIRED glib-2.0) pkg_check_modules (GLIB2 REQUIRED glib-2.0)
SET(GLIB_INCLUDES ${GLIB2_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIRS}/glib-2.0/ ${GLIB2_INCLUDE_DIRS}/glib-2.0/include/) INCLUDE_DIRECTORIES(${GLIB2_INCLUDES_DIRS})
INCLUDE_DIRECTORIES(${GLIB_INCLUDES})
SET(MAIN_SOURCE fastcgi.c fcgi-cgi.c) SET(MAIN_SOURCE fastcgi.c fcgi-cgi.c)
@ -36,15 +35,15 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(fcgi-cgi ${MAIN_SOURCE}) add_executable(fcgi-cgi ${MAIN_SOURCE})
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W -pedantic -fPIC -D_GNU_SOURCE") ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W -pedantic -fPIC")
# libev # libev
TARGET_LINK_LIBRARIES(fcgi-cgi "${LIBEV_LDFLAGS}") TARGET_LINK_LIBRARIES(fcgi-cgi ${LIBEV_LDFLAGS})
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${LIBEV_CFLAGS})
# GLIB 2 # GLIB 2
TARGET_LINK_LIBRARIES(fcgi-cgi "${GLIB2_LIBRARIES}") TARGET_LINK_LIBRARIES(fcgi-cgi ${GLIB2_LDFLAGS})
ADD_TARGET_PROPERTIES(fcgi-cgi LINK_FLAGS "${GLIB2_LDFLAGS}") ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${GLIB2_CFLAGS})
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}" "${LIBEV_CFLAGS}")
INSTALL(TARGETS fcgi-cgi DESTINATION bin) INSTALL(TARGETS fcgi-cgi DESTINATION bin)

View File

@ -1,14 +1,13 @@
MACRO(ADD_TARGET_PROPERTIES _target _name _properties) MACRO(ADD_TARGET_PROPERTIES _target _name)
SET(_properties ${ARGV}) SET(_properties)
LIST(REMOVE_AT _properties 0) FOREACH(_prop ${ARGN})
LIST(REMOVE_AT _properties 0) SET(_properties "${_properties} ${_prop}")
ENDFOREACH(_prop)
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name}) GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
#MESSAGE("adding property to ${_target} ${_name}: ${_properties}") MESSAGE(STATUS "adding property to ${_target} ${_name}:" ${_properties})
IF(NOT _old_properties) IF(NOT _old_properties)
# in case it's NOTFOUND # in case it's NOTFOUND
SET(_old_properties) SET(_old_properties)
ELSE(NOT _old_properties)
SET(_old_properties "${_old_properties} ")
ENDIF(NOT _old_properties) ENDIF(NOT _old_properties)
SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}") SET_TARGET_PROPERTIES(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
ENDMACRO(ADD_TARGET_PROPERTIES) ENDMACRO(ADD_TARGET_PROPERTIES)