-
Notifications
You must be signed in to change notification settings - Fork 240
/
CMakeLists.txt
54 lines (45 loc) · 1.52 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
cmake_minimum_required (VERSION 3.5.1)
project(brynet)
if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
endif()
if(NOT APPLE)
find_library(LIB_OPENSSL NAMES crypto ssl)
if(LIB_OPENSSL)
add_definitions(-DBRYNET_USE_OPENSSL)
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed -ldl -lrt -lssl -lcrypto")
elseif()
message("not found openssl")
endif()
endif()
SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
install(DIRECTORY include/brynet
DESTINATION "${INCLUDE_INSTALL_DIR}")
option(brynet_BUILD_EXAMPLES "Build examples" ON)
option(brynet_BUILD_TESTS "Build test" ON)
if (brynet_BUILD_EXAMPLES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(UNIX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -Wall -Wextra -D_DEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -ggdb -Wall -Wextra -DNDEBUG")
endif()
add_subdirectory(examples)
endif(brynet_BUILD_EXAMPLES)
if (brynet_BUILD_TESTS)
if(WIN32)
if (MSVC_VERSION VERSION_GREATER 1900)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
add_subdirectory(tests)
endif()
elseif(UNIX)
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
endif()
add_subdirectory(tests)
endif()
endif(brynet_BUILD_TESTS)