-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
122 lines (99 loc) · 1.59 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
cmake_minimum_required(VERSION 3.25)
find_package(cmake-fetch REQUIRED PATHS node_modules/cmake-fetch)
project(udx C)
fetch_package("github:libuv/libuv@1.48.0")
add_library(udx OBJECT)
set_target_properties(
udx
PROPERTIES
C_STANDARD 99
POSITION_INDEPENDENT_CODE ON
)
if(UNIX)
target_compile_options(udx PRIVATE -Wall -Wextra)
endif()
if(WIN32)
target_compile_options(udx PRIVATE /W4)
endif()
target_sources(
udx
INTERFACE
include/udx.h
PRIVATE
src/cirbuf.h
src/cirbuf.c
src/endian.h
src/endian.c
src/queue.c
src/queue.h
src/link.h
src/io.h
src/udx.c
)
target_include_directories(
udx
PUBLIC
include
$<TARGET_PROPERTY:uv,INTERFACE_INCLUDE_DIRECTORIES>
)
if(UNIX)
target_sources(
udx
PRIVATE
src/io_posix.c
)
endif()
if(WIN32)
target_sources(
udx
PRIVATE
src/io_win.c
)
endif()
add_library(udx_shared SHARED)
set_target_properties(
udx_shared
PROPERTIES
OUTPUT_NAME udx
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
target_link_libraries(
udx_shared
PUBLIC
udx
uv
)
if(UNIX)
target_link_libraries(
udx_shared
PRIVATE
m
)
endif()
add_library(udx_static STATIC)
set_target_properties(
udx_static
PROPERTIES
OUTPUT_NAME udx
PREFIX lib
)
target_link_libraries(
udx_static
PUBLIC
udx
uv_a
)
if(UNIX)
target_link_libraries(
udx_static
PRIVATE
m
)
endif()
install(TARGETS udx_shared udx_static)
install(FILES include/udx.h DESTINATION include)
if(PROJECT_IS_TOP_LEVEL)
enable_testing()
add_subdirectory(test)
add_subdirectory(examples)
endif()