Added support for cmake

This commit is contained in:
Stefan Bühler 2008-07-21 12:15:58 +02:00
parent 8a82a62528
commit 48ee447c5d
2 changed files with 42 additions and 0 deletions

40
CMakeLists.txt Normal file
View File

@ -0,0 +1,40 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
MACRO(ADD_TARGET_PROPERTIES _target _name _properties)
SET(_properties ${ARGV})
LIST(REMOVE_AT _properties 0)
LIST(REMOVE_AT _properties 0)
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}")
ENDMACRO(ADD_TARGET_PROPERTIES)
PROJECT(spawn-fcgi)
SET(PACKAGE_VERSION 1.0)
EXEC_PROGRAM(date ARGS "'+%b %d %Y %H:%M:%S UTC'" OUTPUT_VARIABLE PACKAGE_BUILD_DATE)
INCLUDE(FindPkgConfig)
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})
add_executable(spawn-fcgi spawn-fcgi.c)
ADD_TARGET_PROPERTIES(spawn-fcgi COMPILE_FLAGS "-std=gnu99 -Wall -g -Wshadow -W -pedantic -fPIC -D_GNU_SOURCE")
ADD_TARGET_PROPERTIES(spawn-fcgi LINK_FLAGS "${GLIB2_LDFLAGS}")
ADD_TARGET_PROPERTIES(spawn-fcgi COMPILE_FLAGS "${GLIB2_CFLAGS_OTHER}")
ADD_DEFINITIONS(
-DPACKAGE_NAME="\\"${CMAKE_PROJECT_NAME}\\""
-DPACKAGE_VERSION="\\"${PACKAGE_VERSION}\\""
-DPACKAGE_BUILD_DATE="\\"${PACKAGE_BUILD_DATE}\\""
)
INSTALL(TARGETS spawn-fcgi DESTINATION bin)

View File

@ -16,7 +16,9 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <sys/un.h> #include <sys/un.h>
#ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif
#define UNUSED(x) ((void)(x)) #define UNUSED(x) ((void)(x))