-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
76 lines (54 loc) · 1.5 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
68
69
70
71
72
73
74
75
76
cmake_minimum_required (VERSION 2.8)
project (CppAwaitSolution CXX)
#
# modules
#
set (CMAKE_MODULE_PATH ${CppAwaitSolution_SOURCE_DIR}/cmake_modules ${CMAKE_MODULE_PATH})
include (precompiled_header)
include (enable_max_warning_level)
#
# Boost
#
set (Boost_USE_STATIC_RUNTIME OFF)
set (Boost_USE_STATIC_LIBS ON)
if (MSVC10 OR MINGW)
# MSVC10 & regular MINGW don't provide chrono & thread, fallback to Boost
set (_boost_deps chrono context thread system)
# mingw-gcc fails to link boost::thread
if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX)
add_definitions (-DBOOST_THREAD_USE_LIB)
endif()
else()
set (_boost_deps context thread system)
endif()
message ("Boost dependencies: ${_boost_deps}")
find_package (Boost 1.58.0 REQUIRED COMPONENTS ${_boost_deps})
message ("Using Boost ${Boost_LIB_VERSION} from ${Boost_INCLUDE_DIRS}")
include_directories (${Boost_INCLUDE_DIRS})
# disable Boost autolinking
add_definitions (-DBOOST_ALL_NO_LIB)
#
# OpenSSL
#
find_package (OpenSSL)
if (OPENSSL_FOUND)
message ("Using OpenSSL ${OPENSSL_VERSION} from ${OPENSSL_INCLUDE_DIR}")
include_directories (${OPENSSL_INCLUDE_DIR})
# enable Flickr example
add_definitions (-DHAVE_OPENSSL)
endif()
#
# defs
#
if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions (--std=gnu++0x -Wno-unused-parameter)
elseif (MSVC)
add_definitions (/wd4100 /wd4127 /wd4913)
endif()
#
# paths
#
set (CMAKE_INCLUDE_CURRENT_DIR TRUE)
include_directories (include)
add_subdirectory (CppAwait)
add_subdirectory (Examples)