-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
83 lines (63 loc) · 1.98 KB
/
CMakeLists.txt
File metadata and controls
83 lines (63 loc) · 1.98 KB
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
80
81
82
83
cmake_minimum_required(VERSION 3.1.0)
if(POLICY CMP0074)
# find_package() uses <PackageName>_ROOT variables.
# This policy was introduced in CMake version 3.12.
cmake_policy(SET CMP0074 NEW)
endif()
project(dcm)
option(DCM_BUILD_UNITTEST "Build unit test?" OFF)
option(DCM_BUILD_EXAMPLES "Build examples?" ON)
option(DCM_BUILD_APPS "Build applications?" ON)
if(WIN32)
option(DCM_ENABLE_VLD "Enable VLD (Visual Leak Detector)?" OFF)
if(DCM_ENABLE_VLD)
add_definitions(-DDCM_ENABLE_VLD)
endif()
endif()
set(DCM_ENABLE_LOG 1 CACHE STRING "Enable logging? (1:Yes, 0:No)")
set(DCM_LOG_LEVEL 2 CACHE STRING "Log level (0:VERB, 1:INFO, 2:USER, 3:WARN, 4:ERRO)")
add_definitions(-DUNICODE -D_UNICODE)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
# C++ standard requirements.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# CMake 3.1.0+ required.
# See: https://stackoverflow.com/a/29871891
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED COMPONENTS system filesystem)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif()
if(DCM_BUILD_UNITTEST)
enable_testing()
endif()
include_directories(
# For including its own headers as "dcm/xxx.h".
${PROJECT_SOURCE_DIR}
# For including config.h as "dcm/config.h".
${PROJECT_BINARY_DIR}
)
set(THIRD_PARTY_DIR ${PROJECT_SOURCE_DIR}/third_party)
if(WIN32)
include_directories(${THIRD_PARTY_DIR}/win32/include)
link_directories(${THIRD_PARTY_DIR}/win32/lib)
endif()
include_directories(${THIRD_PARTY_DIR}/src)
add_subdirectory(dcm)
if(DCM_BUILD_EXAMPLES)
add_subdirectory(${PROJECT_SOURCE_DIR}/examples)
endif()
if(DCM_BUILD_UNITTEST)
add_subdirectory(${THIRD_PARTY_DIR}/src/gtest)
add_subdirectory(unittest)
endif()
if(DCM_BUILD_APPS)
add_subdirectory(apps)
endif()