forked from nitroshare/qhttpengine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (51 loc) · 2.38 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cmake_minimum_required(VERSION 2.8.11)
project(QHttpEngine)
if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3))
cmake_policy(SET CMP0043 OLD)
endif()
set(PROJECT_NAME "QHttpEngine")
set(PROJECT_DESCRIPTION "Simple and secure HTTP server for Qt applications")
set(PROJECT_AUTHOR "Nathan Osman")
set(PROJECT_URL "https://github.com/nitroshare/qhttpengine")
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
option(BUILD_STATIC "Build a static library" OFF)
option(BUILD_DOC "Build Doxygen documentation" OFF)
option(BUILD_EXAMPLES "Build the example applications" OFF)
option(BUILD_TESTS "Build the test suite" OFF)
set(BIN_INSTALL_DIR bin CACHE STRING "Binary runtime installation directory relative to the install prefix")
set(LIB_INSTALL_DIR lib CACHE STRING "Library installation directory relative to the install prefix")
set(INCLUDE_INSTALL_DIR include CACHE STRING "Header installation directory relative to the install prefix")
set(CMAKECONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}" CACHE STRING "CMake configuration installation directory")
set(DOC_INSTALL_DIR share/doc/${PROJECT_NAME} CACHE STRING "Documentation installation directory relative to the install prefix")
set(EXAMPLES_INSTALL_DIR "${LIB_INSTALL_DIR}/${PROJECT_NAME}/examples" CACHE STRING "Examples installation directory relative to the install prefix")
find_package(Qt5Network 5.1 QUIET)
if (NOT Qt5Network_FOUND)
message("-- QT minimum version 5.1 not found, trying with minimum version 4.8")
find_package(Qt4 4.8 QUIET COMPONENTS QtGui QtCore QtNetwork)
if (NOT Qt4_FOUND)
message("-- QT minimum version 4.8 not found")
message(FATAL_ERROR "Qt minimum versio 4.8 is required")
endif()
endif()
message("-- Using QT version ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
if (Qt4_FOUND)
find_package(Git REQUIRED)
message("-- Updating git submodules for QT4 compilation ${Qt4_VERSION}")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
add_subdirectory(src)
if(BUILD_DOC)
add_subdirectory(doc)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()