-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
124 lines (98 loc) · 2.43 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
cmake_minimum_required(VERSION 2.8)
project( MOE )
option(BUILD_EXAMPLES "Builds examples" ON)
option(BUILD_TESTS "Builds Tests" OFF)
option(DEBUG "Enables debug symbols" OFF)
include_directories( "include" )
if(BUILD_TESTS OR COVERAGE)
# Add philsquared/Catch
include_directories( "3rd/catch/single_include" ) # catch.hpp
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
add_compile_options(
-std=c++14
-Wall
-pedantic
)
if(DEBUG)
#Debug Mode
add_compile_options(
-g
)
else()
#Release Mode
add_compile_options(
-O3
)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
add_compile_options(
-std=c++14
-Wall
-pedantic
)
if(COVERAGE)
add_compile_options(
-g
-O0
--coverage
)
set(CMAKE_EXE_LINKER_FLAGS
--coverage
)
set(CMAKE_SHARED_LINKER_FLAGS
--coverage
)
elseif(DEBUG)
#Debug Mode
add_compile_options(
-g
)
else()
#Release Mode
add_compile_options(
-O3
)
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++
add_compile_options(/std=c++14
/W4
)
if(DEBUG)
#Debug Mode
else()
#Release Mode
add_compile_options( /O2t )
endif()
endif()
if(BUILD_EXAMPLES)
set(SOURCE
"examples/hello_world.cpp"
)
add_executable(hello_world ${SOURCE})
set(SOURCE
"examples/square_root.cpp"
)
add_executable(square_root ${SOURCE})
set(SOURCE
"examples/salesman.cpp"
)
add_executable(salesman ${SOURCE})
set(SOURCE
"examples/ps_functions.cpp"
)
add_executable(ps_functions ${SOURCE})
set(SOURCE
"examples/sa_functions.cpp"
)
add_executable(sa_functions ${SOURCE})
endif()
if(BUILD_TESTS OR COVERAGE)
set(SOURCE
"tests/tests.cpp"
)
add_executable(tests ${SOURCE})
endif()