-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·79 lines (66 loc) · 1.89 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
77
78
79
cmake_minimum_required (VERSION 3.1.0 FATAL_ERROR)
project (TriLOc
VERSION 1.0.0
LANGUAGES C CXX)
##############
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6.3")
message(FATAL_ERROR "Insufficient gcc version, should be at least 4.6.3")
endif()
endif()
#############
enable_testing()
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/TinyGarbled)
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR}/TinyGarbled)
##############
# build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
if (CMAKE_BUILD_TYPE MATCHES Debug)
message("Debug build.")
elseif (CMAKE_BUILD_TYPE MATCHES Release)
message("Release build.")
else()
message("Some other build type.")
endif ()
###############
# Compiler flags
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wno-strict-aliasing -march=native")
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
###############
# Library
## Thread
find_package (Threads)
## Boost
set (Boost_USE_STATIC_LIBS OFF)
set (Boost_USE_MULTITHREADED ON)
set (Boost_USE_STATIC_RUNTIME OFF)
find_package (Boost 1.45.0
REQUIRED
COMPONENTS program_options)
if (Boost_FOUND)
include_directories (${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
## OpenSSL
find_package (OpenSSL)
if (OPENSSL_FOUND)
include_directories (${OPENSSL_INCLUDE_DIR})
endif (OPENSSL_FOUND)
###############
# Options
option (ENABLE_DUMP "Enable dump hex feature" OFF)
option (ENABLE_LOG "Enable log feature" OFF)
if (CMAKE_BUILD_TYPE MATCHES Debug)
message("Turn Log on.")
SET(ENABLE_LOG ON BOOL "Turn on logs in debug mode.")
endif (CMAKE_BUILD_TYPE MATCHES Debug)
###############
# Subdirectory
add_subdirectory ("TinyGarbled")
add_subdirectory ("CPP_src")