/
CMakeLists.txt
77 lines (64 loc) · 1.94 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
# Top-level cmake file. All settings are inherited by children cmake files.
# Recursively includes all children cmake files using add_subdirectory(...)
cmake_minimum_required( VERSION 2.6 )
if ($ENV{BUILD_OPTIMIZE})
message("Building release... no debug symbols will be available.")
set(CMAKE_BUILD_TYPE Release)
else()
message("Building debug... performance will not be optimal.")
set(CMAKE_BUILD_TYPE Debug)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
add_definitions(-Du_int16_t="unsigned short")
endif()
if ($ENV{BUILD_FLAGS})
add_definitions ($ENV{BUILD_FLAGS})
endif()
if ($ENV{NO_WARNINGS})
add_definitions ("-w")
endif()
# Work-around for Travis CI
add_definitions( "-DBOOST_NO_CXX11_ALLOCATOR" )
# If we're using GCC< use -fno-pretty-templates to generate more readable templated error messages.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_definitions(-fno-pretty-templates)
endif()
add_definitions ("-DLUA_USE_POSIX" "-Wno-deprecated-declarations" "-DHASHKAT_VERSION=\"$ENV{HASHKAT_VERSION}\"")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DGLIBCXX_DEBUG)
if ($ENV{BUILD_SANITIZE})
SET (CMAKE_EXE_LINKER_FLAGS
-fsanitize=address
)
add_definitions(
-fsanitize=address
)
endif()
else()
add_definitions(-DNDEBUG)
if ($ENV{BUILD_PROF_GEN})
SET (CMAKE_EXE_LINKER_FLAGS
-fprofile-generate
)
add_definitions(
-fprofile-generate
)
elseif( $ENV{BUILD_PROF_USE})
SET (CMAKE_EXE_LINKER_FLAGS
-fprofile-use
)
add_definitions(
-fprofile-use
)
endif()
endif()
add_definitions(-pthread)
if(APPLE)
set(UV_LIBS m "-framework CoreFoundation" "-framework CoreServices")
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(UV_LIBS m pthread)
else()
set(UV_LIBS rt m pthread)
endif()
add_subdirectory(src)
add_subdirectory(tests)