forked from eidheim/Simple-Web-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
52 lines (41 loc) · 1.84 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
cmake_minimum_required (VERSION 2.8.8)
project (Simple-Web-Server)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wsign-conversion")
include_directories(.)
find_package(Threads REQUIRED)
set(BOOST_COMPONENTS system filesystem thread)
# Late 2017 TODO: remove the following checks and always use std::regex
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BOOST_REGEX")
endif()
endif()
find_package(Boost 1.53.0 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
if(APPLE)
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl")
endif()
add_executable(http_examples http_examples.cpp)
target_link_libraries(http_examples ${Boost_LIBRARIES})
target_link_libraries(http_examples ${CMAKE_THREAD_LIBS_INIT})
#TODO: add requirement for version 1.0.1g (can it be done in one line?)
find_package(OpenSSL)
if(OPENSSL_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_OPENSSL")
target_link_libraries(http_examples ${OPENSSL_LIBRARIES})
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
add_executable(https_examples https_examples.cpp)
target_link_libraries(https_examples ${Boost_LIBRARIES})
target_link_libraries(https_examples ${OPENSSL_LIBRARIES})
target_link_libraries(https_examples ${CMAKE_THREAD_LIBS_INIT})
endif()
if(MSYS) #TODO: Is MSYS true when MSVC is true?
target_link_libraries(http_examples ws2_32 wsock32)
if(OPENSSL_FOUND)
target_link_libraries(https_examples ws2_32 wsock32)
endif()
endif()
enable_testing()
add_subdirectory(tests)
install(FILES server_http.hpp client_http.hpp server_https.hpp client_https.hpp crypto.hpp utility.hpp status_code.hpp DESTINATION include/simple-web-server)