forked from lpereira/lwan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
54 lines (45 loc) · 1.5 KB
/
CMakeLists.txt
File metadata and controls
54 lines (45 loc) · 1.5 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
project(lwan C)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow")
if (${CMAKE_BUILD_TYPE} MATCHES "Rel")
message(STATUS "Enabling compiler optimizations")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mtune=native -O3 -flto")
include(CheckCCompilerFlag)
check_c_compiler_flag(-mcrc32 HAS_CRC32)
if (HAS_CRC32)
set(USE_HARDWARE_CRC32 1)
add_definitions("-DUSE_HARDWARE_CRC32=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcrc32")
endif ()
endif ()
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
find_library(TCMALLOC_LIBRARY
NAMES tcmalloc_minimal tcmalloc
PATHS /usr/lib /usr/local/lib)
if (TCMALLOC_LIBRARY)
message(STATUS "tcmalloc found: ${TCMALLOC_LIBRARY}")
set(MALLOC_LIB ${TCMALLOC_LIBRARY})
else ()
find_library(JEMALLOC_LIBRARY
NAMES jemalloc
PATHS /usr/lib /usr/local/lib)
if (JEMALLOC_LIBRARY)
message(STATUS "jemalloc found: ${JEMALLOC_LIBRARY}")
set(MALLOC_LIB ${JEMALLOC_LIBRARY})
else ()
message(STATUS "jemalloc and tcmalloc were not found, using system malloc")
set(MALLOC_LIB "")
endif()
endif()
find_path(VALGRIND_INCLUDE_DIR valgrind.h /usr/include /usr/include/valgrind /usr/local/include /usr/local/include/valgrind)
if (VALGRIND_INCLUDE_DIR)
message(STATUS "Building with Valgrind support")
add_definitions("-DUSE_VALGRIND=1")
else ()
message(STATUS "Valgrind headers not found -- disabling valgrind support")
endif()
add_subdirectory(common)
include_directories(common)
add_subdirectory(lwan)
add_subdirectory(freegeoip)