| 1 |
PROJECT(FastCgiQt) |
| 2 |
# Stop cmake 2.6 from whining |
| 3 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) |
| 4 |
IF(COMMAND cmake_policy) |
| 5 |
CMAKE_POLICY(SET CMP0003 NEW) |
| 6 |
ENDIF(COMMAND cmake_policy) |
| 7 |
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) |
| 8 |
|
| 9 |
# If building for release, don't include QDebug stuff |
| 10 |
IF("x${CMAKE_BUILD_TYPE}" STREQUAL "x") |
| 11 |
SET(CMAKE_BUILD_TYPE "Release") |
| 12 |
ENDIF() |
| 13 |
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release") |
| 14 |
ADD_DEFINITIONS("-DQT_NO_DEBUG_OUTPUT") |
| 15 |
ENDIF() |
| 16 |
|
| 17 |
# Developer options |
| 18 |
OPTION(WARNINGS_AS_ERRORS "Treat all compiler warnings as errors" OFF) |
| 19 |
|
| 20 |
# Configuration options |
| 21 |
OPTION(BUILD_EXAMPLES "Build several example applications" OFF) |
| 22 |
OPTION(WITH_SERVICE_SUPPORT "Build helper classes for service-based applications" ON) |
| 23 |
OPTION(WITH_SQL_SUPPORT "Build helper classes for interacting with databases" ON) |
| 24 |
OPTION(WITH_MEMCACHED_SUPPORT "Build plugin for using memcached - needs libmemcached" OFF) |
| 25 |
OPTION(WITH_FASTCGI_SUPPORT "Build support for the FastCGI interface" ON) |
| 26 |
OPTION(WITH_SCGI_SUPPORT "Build support for the SCGI interface" ON) |
| 27 |
OPTION(WITH_HTTP_SUPPORT "Build support for an embedded HTTPD (only for development)" ON) |
| 28 |
OPTION(WITH_CGI_SUPPORT "Build support for plain old CGI" ON) |
| 29 |
|
| 30 |
IF(WITH_SERVICE_SUPPORT) |
| 31 |
MESSAGE(STATUS "Service support is enabled.") |
| 32 |
OPTION(WITH_XSLT_SUPPORT "Build helper class for XSLT-based applications - needs Qt 4.5" ON) |
| 33 |
ELSE() |
| 34 |
MESSAGE(STATUS "Service support is *NOT* enabled.") |
| 35 |
ENDIF() |
| 36 |
|
| 37 |
# Platform configuration |
| 38 |
IF(CMAKE_COMPILER_IS_GNUCXX) |
| 39 |
MESSAGE(STATUS "Applying platform configuration for GCC") |
| 40 |
ADD_DEFINITIONS("-Wall") |
| 41 |
IF(WARNINGS_AS_ERRORS) |
| 42 |
ADD_DEFINITIONS("-Werror") |
| 43 |
ENDIF() |
| 44 |
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") |
| 45 |
MESSAGE(STATUS "Applying platform configuration for Sun Studio compiler") |
| 46 |
ADD_DEFINITIONS( |
| 47 |
"-erroff=nullref" # incompatible with qobject_cast<> |
| 48 |
"-errtags=yes" |
| 49 |
"-DWITHOUT_FLOCK" |
| 50 |
) |
| 51 |
IF(WARNINGS_AS_ERRORS) |
| 52 |
ADD_DEFINITIONS("-errwarn=%all") |
| 53 |
ENDIF() |
| 54 |
ELSE() |
| 55 |
MESSAGE(WARNING "Don't have a specific configuration for this compiler: ${CMAKE_CXX_COMPILER_ID}") |
| 56 |
ENDIF() |
| 57 |
|
| 58 |
|
| 59 |
# Find Qt4 |
| 60 |
ADD_DEFINITIONS(-DQT_STATICPLUGIN) |
| 61 |
FIND_PACKAGE( Qt4 REQUIRED ) |
| 62 |
|
| 63 |
SET(CMAKE_OSX_ARCHITECTURES i386) |
| 64 |
|
| 65 |
SET(QT_DONT_USE_QTGUI TRUE) |
| 66 |
SET(QT_USE_QTNETWORK TRUE) |
| 67 |
IF(WITH_SQL_SUPPORT) |
| 68 |
SET(QT_USE_QTSQL TRUE) |
| 69 |
MESSAGE(STATUS "SQL support is enabled.") |
| 70 |
ELSE() |
| 71 |
MESSAGE(STATUS "SQL support is *NOT* enabled.") |
| 72 |
ENDIF() |
| 73 |
IF(WITH_XSLT_SUPPORT) |
| 74 |
SET(QT_USE_QTXMLPATTERNS TRUE) |
| 75 |
ENDIF() |
| 76 |
|
| 77 |
# Include the cmake file needed to use qt4 |
| 78 |
INCLUDE( ${QT_USE_FILE} ) |
| 79 |
|
| 80 |
# Subdirs |
| 81 |
ADD_SUBDIRECTORY(lib) |
| 82 |
IF(BUILD_EXAMPLES) |
| 83 |
ADD_SUBDIRECTORY(examples) |
| 84 |
ENDIF() |