This repository has been archived by the owner on Apr 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
48 lines (34 loc) · 1.46 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
cmake_minimum_required(VERSION 2.8)
project(libcoco)
enable_language(C ASM)
set(CMAKE_BUILD_TYPE "Debug")
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -export-dynamic -g -fno-strict-aliasing -ggdb -O0 -std=c99 -Wall -pipe -D_GNU_SOURCE -D_REENTRANT -fPIC -Wno-deprecated -m64")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
include_directories(include)
set_source_files_properties(src/cc_ctx_swap.S PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
set(DIR_SRCS src/cc_ctx.c src/cc_routine.c src/cc_ctx_swap.S src/cc_epoll.c src/cc_hook_sys_call.c)
set(LINK_LIBS dl)
if(CMAKE_THREAD_LIBS_INIT)
set(LINK_LIBS ${LINK_LIBS} "${CMAKE_THREAD_LIBS_INIT}")
endif()
add_library(coco ${DIR_SRCS})
if(THREADS_HAVE_PTHREAD_ARG)
target_compile_options(coco PUBLIC "-pthread")
endif()
target_link_libraries(coco ${LINK_LIBS})
add_executable(test_cond test/test_cond.c)
target_link_libraries(test_cond coco)
add_executable(test_copystack test/test_copystack.c)
target_link_libraries(test_copystack coco)
add_executable(test_setenv test/test_setenv.c)
target_link_libraries(test_setenv coco)
add_executable(test_thread test/test_thread.c)
target_link_libraries(test_thread coco)
add_executable(test_specific test/test_specific.c)
target_link_libraries(test_specific coco)
add_executable(test_poll test/test_poll.c)
target_link_libraries(test_poll coco)
add_executable(test_echosrv test/test_echosrv.c)
target_link_libraries(test_echosrv coco)