-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
55 lines (46 loc) · 1.07 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
cmake_minimum_required(VERSION 3.13)
project(nftp-codec)
SET(DEBUG ON)
SET(TEST ON)
if(DEBUG)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -g")
add_definitions(-DDEBUG)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif(DEBUG)
# SET(LOGTOFILE "/tmp/a.txt")
if(LOGTOFILE)
add_compile_definitions(LOGTOFILE=\"${LOGTOFILE}\")
endif(LOGTOFILE)
#add_subdirectory(hashtable)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/hashtable)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
set(SOURCES
src/hash.c
src/file.c
src/vector.c
src/iovs.c
src/iter.c
src/codec.c
src/proto.c
hashtable/hashtable.c
)
add_library(nftp-codec SHARED ${SOURCES})
add_library(nftp-codec-static STATIC ${SOURCES})
if(TEST)
add_executable(test
test/test.h
test/test.c
test/hash.c
test/file.c
test/vector.c
test/iovs.c
test/iter.c
test/codec.c
test/proto.c)
target_link_libraries(test nftp-codec)
endif(TEST)
if(NOT DEBUG)
target_compile_options(nftp-codec PUBLIC -O3 -Os)
endif()