This repository has been archived by the owner on Oct 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
CMakeLists.txt
41 lines (30 loc) · 1.63 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
project(state-threads)
cmake_minimum_required(VERSION 2.6)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g3 -ggdb")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -fPIC -std=gnu99 -pedantic -pthread -Wall -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wno-missing-field-initializers -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes")
add_definitions(-DMD_HAVE_EPOLL -DLINUX -D_GNU_SOURCE)
# check for valgrind. this should really be in FindValgrind.cmake
# http://www.itk.org/Wiki/CMake:How_To_Find_Installed_Software
find_file(VALGRIND_H valgrind.h /usr/include/valgrind /usr/local/include/valgrind)
message("valgrind headers: ${VALGRIND_H}")
if(NOT VALGRIND_H)
# this will remove valgrind stack tracking support from state-threads
add_definitions(-DNVALGRIND)
endif(NOT VALGRIND_H)
exec_program(${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/public.h ${CMAKE_CURRENT_BINARY_DIR}/st.h)
# use gcc for the asm file because it needs to be
# pre-processed by cpp first
SET_SOURCE_FILES_PROPERTIES(md.S PROPERTIES LANGUAGE C)
add_library(st STATIC md.S event.c io.c key.c sched.c stk.c sync.c)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(server examples/server.c examples/error.c)
target_link_libraries(server st)
add_executable(lookupdns examples/lookupdns.c examples/res.c)
target_link_libraries(lookupdns st resolv)
add_executable(threaded examples/threaded.c)
target_link_libraries(threaded st)
add_subdirectory(extensions)