-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
106 lines (85 loc) · 1.3 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
cmake_minimum_required(VERSION 3.22)
project(tt C)
if(NOT TARGET uv)
add_subdirectory(vendor/libuv EXCLUDE_FROM_ALL)
endif()
add_library(tt OBJECT)
set_target_properties(
tt
PROPERTIES
C_STANDARD 99
POSITION_INDEPENDENT_CODE ON
)
target_sources(
tt
INTERFACE
include/tt.h
PRIVATE
src/pty.c
)
if(UNIX)
target_sources(
tt
PRIVATE
src/unix/pty.c
)
endif()
if(WIN32)
target_sources(
tt
PRIVATE
src/win/pty.c
)
endif()
target_include_directories(
tt
PUBLIC
include
$<TARGET_PROPERTY:uv,INTERFACE_INCLUDE_DIRECTORIES>
)
add_library(tt_shared SHARED)
set_target_properties(
tt_shared
PROPERTIES
OUTPUT_NAME tt
WINDOWS_EXPORT_ALL_SYMBOLS ON
)
target_link_libraries(
tt_shared
PUBLIC
tt
uv
)
if(UNIX)
target_link_libraries(
tt_shared
PUBLIC
-lutil
)
endif()
add_library(tt_static STATIC)
set_target_properties(
tt_static
PROPERTIES
OUTPUT_NAME tt
)
target_link_libraries(
tt_static
PUBLIC
tt
uv_a
)
if(UNIX)
target_link_libraries(
tt_static
PUBLIC
-lutil
)
endif()
install(TARGETS tt_shared tt_static)
install(FILES include/tt.h DESTINATION include)
install(DIRECTORY include/tt DESTINATION include)
if(PROJECT_IS_TOP_LEVEL)
enable_testing()
add_subdirectory(test)
endif()