aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2008-09-23 12:40:30 +0200
committerStefan Bühler <stbuehler@web.de>2008-09-23 12:40:30 +0200
commit135d8dd7a40a7bfc40d49e98f07456c7202bd63b (patch)
treeaaa31710221b471b2513cfebbb1b3162a332545c
parent96f580b772eab2f58421b1b7758e6467d910e7ee (diff)
downloadfcgi-debug-135d8dd7a40a7bfc40d49e98f07456c7202bd63b.tar.gz
fcgi-debug-135d8dd7a40a7bfc40d49e98f07456c7202bd63b.zip
Cleanup cmake; added static build and install target
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/LighttpdMacros.cmake9
-rw-r--r--src/CMakeLists.txt52
3 files changed, 56 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9bd4eae..fa82b65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,12 +4,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
-SET(CPACK_PACKAGE_VERSION_MAJOR 2)
-SET(CPACK_PACKAGE_VERSION_MINOR 0)
+SET(CPACK_PACKAGE_VERSION_MAJOR 0)
+SET(CPACK_PACKAGE_VERSION_MINOR 1)
SET(CPACK_PACKAGE_VERSION_PATCH 0)
-#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
-#SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
SET(CPACK_PACKAGE_VENDOR "lighttpd@stbuehler.de")
SET(CPACK_SOURCE_GENERATOR "TGZ")
diff --git a/cmake/LighttpdMacros.cmake b/cmake/LighttpdMacros.cmake
index 68b5f20..1eac941 100644
--- a/cmake/LighttpdMacros.cmake
+++ b/cmake/LighttpdMacros.cmake
@@ -5,10 +5,17 @@ MACRO(ADD_TARGET_PROPERTIES _target _name)
SET(_properties "${_properties} ${_prop}")
ENDFOREACH(_prop)
GET_TARGET_PROPERTY(_old_properties ${_target} ${_name})
- MESSAGE("adding property to ${_target} ${_name}:" ${_properties})
+# 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)
+
+MACRO(TARGET_USE_PACKAGE _target _ldirs _libs _lflags _cflags)
+ LINK_DIRECTORIES(${_ldirs})
+ TARGET_LINK_LIBRARIES(fcgi-debug ${_libs})
+ ADD_TARGET_PROPERTIES(fcgi-debug LINK_FLAGS "${_lflags}")
+ ADD_TARGET_PROPERTIES(fcgi-debug COMPILE_FLAGS ${_cflags})
+ENDMACRO(TARGET_USE_PACKAGE)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f658851..ecd0af6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,6 +12,8 @@ INCLUDE(LighttpdMacros)
FIND_PACKAGE(Ragel REQUIRED)
cmake_policy(SET CMP0005 OLD)
+OPTION(BUILD_STATIC "build a static fcgi-debug")
+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
# libev
@@ -19,7 +21,12 @@ CHECK_INCLUDE_FILES(ev.h HAVE_EV_H)
IF(HAVE_EV_H)
CHECK_LIBRARY_EXISTS(ev ev_loop "" HAVE_LIBEV)
IF(HAVE_LIBEV)
- SET(EV_LDFLAGS -lev)
+ SET(EV_LIBRARIES ev)
+ SET(EV_STATIC_LIBRARIES ev;m)
+ CHECK_LIBRARY_EXISTS(rt clock_gettime "" NEED_RT)
+ IF(NEED_RT)
+ SET(EV_STATIC_LIBRARIES ${EV_STATIC_LIBRARIES} rt)
+ ENDIF(NEED_RT)
ELSE(HAVE_LIBEV)
MESSAGE(FATAL_ERROR "Couldn't find lib ev")
ENDIF(HAVE_LIBEV)
@@ -28,8 +35,7 @@ ELSE(HAVE_EV_H)
ENDIF(HAVE_EV_H)
# glib/gthread
-pkg_check_modules(GTHREAD REQUIRED gthread-2.0)
-#INCLUDE_DIRECTORIES(${GTHREAD_INCLUDE_DIRS})
+pkg_check_modules(GLIB REQUIRED glib-2.0>=2.12)
ADD_DEFINITIONS(
-DPACKAGE_NAME="\\"${CMAKE_PROJECT_NAME}\\""
@@ -56,8 +62,37 @@ ADD_EXECUTABLE(fcgi-debug
parse-fastcgi.c
)
-ADD_TARGET_PROPERTIES(fcgi-debug LINK_FLAGS ${EV_LDFLAGS})
-ADD_TARGET_PROPERTIES(fcgi-debug COMPILE_FLAGS ${EV_CFLAGS})
+IF(BUILD_STATIC)
+ ADD_TARGET_PROPERTIES(fcgi-debug LINK_FLAGS -static)
+
+ TARGET_USE_PACKAGE(fcgi-debug
+ "${EV_STATIC_LIBARARY_DIRS}"
+ "${EV_STATIC_LIBRARIES}"
+ "${EV_STATIC_LDFLAGS_OTHERS}"
+ "${EV_STATIC_CFLAGS}"
+ )
+
+ TARGET_USE_PACKAGE(fcgi-debug
+ "${GLIB_STATIC_LIBARARY_DIRS}"
+ "${GLIB_STATIC_LIBRARIES}"
+ "${GLIB_STATIC_LDFLAGS_OTHERS}"
+ "${GLIB_STATIC_CFLAGS}"
+ )
+ELSE(BUILD_STATIC)
+ TARGET_USE_PACKAGE(fcgi-debug
+ "${EV_LIBARARY_DIRS}"
+ "${EV_LIBRARIES}"
+ "${EV_LDFLAGS_OTHERS}"
+ "${EV_CFLAGS}"
+ )
+
+ TARGET_USE_PACKAGE(fcgi-debug
+ "${GLIB_LIBARARY_DIRS}"
+ "${GLIB_LIBRARIES}"
+ "${GLIB_LDFLAGS_OTHERS}"
+ "${GLIB_CFLAGS}"
+ )
+ENDIF(BUILD_STATIC)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic")
@@ -67,7 +102,8 @@ IF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-D_GNU_SOURCE)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
-ADD_TARGET_PROPERTIES(fcgi-debug LINK_FLAGS ${GTHREAD_LDFLAGS})
-ADD_TARGET_PROPERTIES(fcgi-debug COMPILE_FLAGS ${GTHREAD_CFLAGS})
+#SET_TARGET_PROPERTIES(fcgi-debug PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
-SET_TARGET_PROPERTIES(fcgi-debug PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+INSTALL(TARGETS fcgi-debug
+ RUNTIME DESTINATION bin
+ )