Browse Source

[cmake] fix macros, glib2 including and libev cflags

master
Stefan Bühler 8 years ago
parent
commit
ef2ff3f599
  1. 13
      CMakeLists.txt
  2. 15
      cmake/AddTargetProperties.cmake

13
CMakeLists.txt

@ -23,8 +23,7 @@ FIND_PACKAGE(LibEV REQUIRED)
# GLIB 2
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(${GLIB_INCLUDES})
INCLUDE_DIRECTORIES(${GLIB2_INCLUDES_DIRS})
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_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
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
TARGET_LINK_LIBRARIES(fcgi-cgi "${GLIB2_LIBRARIES}")
ADD_TARGET_PROPERTIES(fcgi-cgi LINK_FLAGS "${GLIB2_LDFLAGS}")
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}" "${LIBEV_CFLAGS}")
TARGET_LINK_LIBRARIES(fcgi-cgi ${GLIB2_LDFLAGS})
ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${GLIB2_CFLAGS})
INSTALL(TARGETS fcgi-cgi DESTINATION bin)

15
cmake/AddTargetProperties.cmake

@ -1,14 +1,13 @@
MACRO(ADD_TARGET_PROPERTIES _target _name _properties)
SET(_properties ${ARGV})
LIST(REMOVE_AT _properties 0)
LIST(REMOVE_AT _properties 0)
MACRO(ADD_TARGET_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}")
MESSAGE(STATUS "adding property to ${_target} ${_name}:" ${_properties})
IF(NOT _old_properties)
# in case it's NOTFOUND
SET(_old_properties)
ELSE(NOT _old_properties)
SET(_old_properties "${_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)
Loading…
Cancel
Save