FastCGI application to run cgi applications https://redmine.lighttpd.net/projects/fcgi-cgi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.6 KiB

12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
  1. CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
  2. CMAKE_POLICY(VERSION 2.6.0)
  3. SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
  4. INCLUDE(CheckIncludeFiles)
  5. INCLUDE(CheckLibraryExists)
  6. INCLUDE(FindPkgConfig)
  7. INCLUDE(AddTargetProperties)
  8. PROJECT(fcgi-cgi C)
  9. SET(PACKAGE_VERSION 0.2.2)
  10. IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
  11. SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
  12. ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
  13. OPTION(BUILD_EXTRA_WARNINGS "extra warnings")
  14. # default to ON
  15. set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Default value for ``POSITION_INDEPENDENT_CODE`` of targets.")
  16. # handle BUILD_EXTRA_WARNINGS option
  17. IF(BUILD_EXTRA_WARNINGS)
  18. SET(WARN_CFLAGS "-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -Wmissing-prototypes -Wshadow -Wno-pointer-sign -Wformat-security")
  19. SET(WARN_LDFLAGS "-g -O2 -g2 -Wall -Wl,--as-needed -Wl,--no-undefined")
  20. ELSE(BUILD_EXTRA_WARNINGS)
  21. SET(WARN_CFLAGS "")
  22. SET(WARN_LDFLAGS "")
  23. ENDIF(BUILD_EXTRA_WARNINGS)
  24. IF(CMAKE_COMPILER_IS_GNUCC)
  25. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -g -Wshadow -W -pedantic")
  26. SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
  27. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
  28. SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2")
  29. ENDIF(CMAKE_COMPILER_IS_GNUCC)
  30. # libev
  31. FIND_PACKAGE(LibEV REQUIRED)
  32. # GLIB 2
  33. pkg_check_modules (GLIB2 REQUIRED glib-2.0)
  34. INCLUDE_DIRECTORIES(${GLIB2_INCLUDES_DIRS})
  35. SET(MAIN_SOURCE fastcgi.c fcgi-cgi.c)
  36. SET(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
  37. SET(PACKAGE_VERSION ${PACKAGE_VERSION})
  38. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h ESCAPE_QUOTES)
  39. ADD_DEFINITIONS(-DHAVE_CONFIG_H)
  40. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
  41. ADD_EXECUTABLE(fcgi-cgi ${MAIN_SOURCE})
  42. TARGET_LINK_LIBRARIES(fcgi-cgi ${WARN_LDFLAGS})
  43. ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${WARN_CFLAGS})
  44. # libev
  45. TARGET_LINK_LIBRARIES(fcgi-cgi ${LIBEV_LDFLAGS})
  46. ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${LIBEV_CFLAGS})
  47. # GLIB 2
  48. TARGET_LINK_LIBRARIES(fcgi-cgi ${GLIB2_LDFLAGS})
  49. ADD_TARGET_PROPERTIES(fcgi-cgi COMPILE_FLAGS ${GLIB2_CFLAGS})
  50. INSTALL(TARGETS fcgi-cgi DESTINATION bin)
  51. # man page
  52. SET(CMAKE_MAN_DIR "share/man" CACHE STRING
  53. "Install location for man pages (relative to prefix).")
  54. MARK_AS_ADVANCED(CMAKE_MAN_DIR)
  55. INSTALL(FILES fcgi-cgi.1 DESTINATION ${CMAKE_MAN_DIR}/man1)