aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2008-07-21 12:15:58 +0200
committerStefan Bühler <stbuehler@web.de>2008-07-21 12:15:58 +0200
commit48ee447c5d10707497f2f6f27e4633d4547c7056 (patch)
treeb1523feccf80e91bec6221e42e35a2b4f2fbc6c8
parent8a82a625288bf9668c61a3b3f3ca0f86e603b013 (diff)
downloadspawn-fcgi2-48ee447c5d10707497f2f6f27e4633d4547c7056.tar.gz
spawn-fcgi2-48ee447c5d10707497f2f6f27e4633d4547c7056.zip
Added support for cmake
-rw-r--r--CMakeLists.txt40
-rw-r--r--spawn-fcgi.c2
2 files changed, 42 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b7f9a01
--- /dev/null
+++ b/CMakeLists.txt
@@ -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)
diff --git a/spawn-fcgi.c b/spawn-fcgi.c
index 3789487..1897da4 100644
--- a/spawn-fcgi.c
+++ b/spawn-fcgi.c
@@ -16,7 +16,9 @@
#include <arpa/inet.h>
#include <sys/un.h>
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#define UNUSED(x) ((void)(x))