|
| 1 | +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) |
| 2 | + |
| 3 | +IF(COMMAND CMAKE_POLICY) |
| 4 | + CMAKE_POLICY(SET CMP0003 OLD) |
| 5 | +ENDIF(COMMAND CMAKE_POLICY) |
| 6 | + |
| 7 | +PROJECT(WT) |
| 8 | +SET(CMAKE_MODULE_PATH ${WT_SOURCE_DIR}) |
| 9 | + |
| 10 | +SET(VERSION_SERIES 2) |
| 11 | +SET(VERSION_MAJOR 2) |
| 12 | +SET(VERSION_MINOR 3) |
| 13 | + |
| 14 | +SET(WT_SOVERSION 11) |
| 15 | +SET(WTEXT_SOVERSION 6) |
| 16 | +SET(WTHTTP_SOVERSION 4) |
| 17 | +SET(WTFCGI_SOVERSION 4) |
| 18 | + |
| 19 | +# |
| 20 | +# Various things that must be configured by the user or packager ... |
| 21 | +# |
| 22 | + |
| 23 | +IF(NOT SHARED_LIBS) |
| 24 | + IF(WIN32) |
| 25 | + OPTION(SHARED_LIBS "Compile shared libraries" OFF) |
| 26 | + ELSE(WIN32) |
| 27 | + OPTION(SHARED_LIBS "Compile shared libraries" ON) |
| 28 | + ENDIF(WIN32) |
| 29 | +ENDIF(NOT SHARED_LIBS) |
| 30 | + |
| 31 | +# Fixup Windows declspec stuff |
| 32 | +IF(NOT SHARED_LIBS) |
| 33 | + SET(WT_STATIC true) |
| 34 | + SET(WTHTTP_STATIC true) |
| 35 | + SET(WT_EXT_STATIC true) |
| 36 | +ENDIF(NOT SHARED_LIBS) |
| 37 | + |
| 38 | +IF(NOT MULTI_THREADED) |
| 39 | + OPTION(MULTI_THREADED "Build multi-threaded httpd deamon (if possible)" ON) |
| 40 | +ENDIF(NOT MULTI_THREADED) |
| 41 | + |
| 42 | +SET(BUILD_SHARED_LIBS ${SHARED_LIBS}) |
| 43 | + |
| 44 | +IF(WIN32) |
| 45 | + SET(USERLIB_ROOT "c:/libraries" CACHE PATH "directory containing the dependency libraries") |
| 46 | + SET(LIB_INSTALL_DIR "lib" CACHE STRING "Default path for libraries within ${CMAKE_INSTALL_PREFIX}") |
| 47 | + SET(RUNDIR "c:/witty" CACHE PATH "Not really used in WIN32") |
| 48 | + IF( NOT DEFINED CONFIGDIR ) |
| 49 | + SET(CONFIGDIR ${RUNDIR} CACHE STRING "Path for the configuration files") |
| 50 | + ENDIF( NOT DEFINED CONFIGDIR ) |
| 51 | + SET(DEPLOYROOT c:/witty/wt-examples CACHE PATH "Path to deploy examples into") |
| 52 | + SET(BOOST_DIR ${USERLIB_ROOT} CACHE PATH "Use boost in directory") |
| 53 | + SET(BOOST_VERSION "1_35" CACHE STRING "Use boost version in BOOST_DIR") |
| 54 | + SET(GD_DIR ${USERLIB_ROOT} CACHE PATH "Search path for libgd") |
| 55 | + OPTION(BOOST_DYNAMIC "Link to boost DLLs (OFF means static link)" OFF) |
| 56 | + OPTION(MXML_SUPPLIED "Force use of supplied mxml over installed mxml." ON) |
| 57 | + |
| 58 | +ELSE(WIN32) |
| 59 | + |
| 60 | + SET(USERLIB_ROOT /usr CACHE PATH "Other installation prefix for dependent libraries") |
| 61 | + SET(LIB_INSTALL_DIR "lib" CACHE STRING "Default path for libraries within ${CMAKE_INSTALL_PREFIX}") |
| 62 | + SET(RUNDIR "/usr/wt/run" CACHE PATH "Default path for wt session management (only used by FCGI connector; not relative to CMAKE_INSTALL_PREFIX)") |
| 63 | + IF( NOT DEFINED CONFIGDIR ) |
| 64 | + SET(CONFIGDIR "/etc/wt" CACHE STRING "Path for the configuration files") |
| 65 | + ENDIF( NOT DEFINED CONFIGDIR ) |
| 66 | + SET(DEPLOYROOT /var/www/localhost/htdocs/wt-examples CACHE PATH "Path to deploy examples into)") |
| 67 | + SET(BOOST_DIR /usr CACHE PATH "Boost installation path prefix") |
| 68 | + SET(BOOST_COMPILER gcc CACHE STRING "Boost libraries compiler signature") |
| 69 | + SET(BOOST_VERSION "1_35" CACHE STRING "Boost libraries version signature") |
| 70 | + SET(GD_DIR "/usr/lib" CACHE PATH "Search path for libgd2") |
| 71 | + OPTION(MXML_SUPPLIED "Force use of supplied mxml over installed mxml." ON) |
| 72 | + |
| 73 | +ENDIF(WIN32) |
| 74 | + |
| 75 | +MARK_AS_ADVANCED( CONFIGDIR ) |
| 76 | +SET(CONFIGURATION "${CONFIGDIR}/wt_config.xml" CACHE PATH "Path to the wt configuration file") |
| 77 | +SET(WTHTTP_CONFIGURATION ${CONFIGDIR}/wthttpd CACHE PATH "Path for the wthttpd configuration file") |
| 78 | + |
| 79 | +SET(WEBUSER apache CACHE STRING "Webserver username (e.g. apache or www)") |
| 80 | +SET(WEBGROUP apache CACHE STRING "Webserver groupname (e.g. apache or www or users)") |
| 81 | +OPTION(CONNECTOR_FCGI "Compile in FCGI connector (libwtfcgi) ?" OFF) |
| 82 | +OPTION(CONNECTOR_HTTP "Compile in stand-alone httpd connector (libwthttp) ?" ON) |
| 83 | +SET(EXAMPLES_CONNECTOR wthttp CACHE STRING "Connector used for examples") |
| 84 | + |
| 85 | +INCLUDE(cmake/WtFindBoost.txt) |
| 86 | +INCLUDE(cmake/WtFindGd.txt) |
| 87 | +INCLUDE(cmake/WtFindFcgi.txt) |
| 88 | +INCLUDE(cmake/WtFindMxml.txt) |
| 89 | +INCLUDE(cmake/WtFindZlib.txt) |
| 90 | +INCLUDE(cmake/WtFindAsio.txt) |
| 91 | +INCLUDE(cmake/WtFindSsl.txt) |
| 92 | +INCLUDE(cmake/WtFindMysqlpp.txt) |
| 93 | + |
| 94 | +FIND_PACKAGE(Qt4) |
| 95 | + |
| 96 | +# Boost is used nearly everywhere, so we can put these here |
| 97 | +INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIRS}) |
| 98 | +LINK_DIRECTORIES(${BOOST_LIB_DIRS}) |
| 99 | +IF(WIN32) |
| 100 | + IF(BOOST_DYNAMIC) |
| 101 | + ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) |
| 102 | + ENDIF(BOOST_DYNAMIC) |
| 103 | +ENDIF(WIN32) |
| 104 | + |
| 105 | +IF(NOT CMAKE_BUILD_TYPE) |
| 106 | + SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING |
| 107 | + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." |
| 108 | + FORCE) |
| 109 | +ENDIF(NOT CMAKE_BUILD_TYPE) |
| 110 | + |
| 111 | +# Compile time constants & make sure our build finds it |
| 112 | +FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Wt) |
| 113 | +SET(WCONFIG_H_PATH ${CMAKE_CURRENT_BINARY_DIR}/Wt/WConfig.h) |
| 114 | +CONFIGURE_FILE( |
| 115 | + ${WT_SOURCE_DIR}/WConfig.h.in |
| 116 | + ${WCONFIG_H_PATH} |
| 117 | +) |
| 118 | +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) |
| 119 | +INSTALL_FILES(/include/Wt FILES ${WCONFIG_H_PATH}) |
| 120 | + |
| 121 | +IF(WIN32) |
| 122 | + SUBDIRS(src examples) |
| 123 | +ELSE(WIN32) |
| 124 | + SUBDIRS(src EXCLUDE_FROM_ALL examples) |
| 125 | +ENDIF(WIN32) |
| 126 | + |
| 127 | +IF( NOT DEFINED WT_CMAKE_FINDER_INSTALL_DIR ) |
| 128 | + SET( WT_CMAKE_FINDER_INSTALL_DIR "share/cmake-2.4/Modules" ) |
| 129 | +ENDIF( NOT DEFINED WT_CMAKE_FINDER_INSTALL_DIR) |
| 130 | + |
| 131 | +INSTALL(FILES ${PROJECT_SOURCE_DIR}/cmake/FindWt.cmake DESTINATION |
| 132 | + ${CMAKE_INSTALL_PREFIX}/${WT_CMAKE_FINDER_INSTALL_DIR} ) |
| 133 | + |
| 134 | +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/resources DESTINATION |
| 135 | + ${CMAKE_INSTALL_PREFIX}/share/Wt/) |
| 136 | + |
| 137 | +INSTALL(FILES ${PROJECT_SOURCE_DIR}/wt_config.xml DESTINATION ${CONFIGDIR} ) |
0 commit comments