3 # Disable warnings to avoid changing 3rd party code.
4 if(CMAKE_C_COMPILER_ID MATCHES
5 "^(GNU|LCC|Clang|AppleClang|IBMClang|XLClang|XL|VisualAge|SunPro|HP|Intel|IntelLLVM|NVHPC)$")
6 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
7 elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
8 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
13 set(uv_libraries ${CMAKE_THREAD_LIBS_INIT})
14 set(uv_includes include src)
18 include/uv/threadpool.h
36 src/uv-data-getter-setters.c
40 list(APPEND uv_libraries
47 list(APPEND uv_includes
50 list(APPEND uv_defines
54 list(APPEND uv_headers
58 list(APPEND uv_sources
60 src/win/atomicops-inl.h
62 src/win/detect-wakeup.c
72 src/win/loop-watcher.c
75 src/win/process-stdio.c
93 list(APPEND uv_includes
96 list(APPEND uv_headers
99 list(APPEND uv_sources
101 src/unix/atomic-ops.h
105 src/unix/getaddrinfo.c
106 src/unix/getnameinfo.c
108 src/unix/loop-watcher.c
123 if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
124 list(APPEND uv_libraries
127 list(APPEND uv_headers
130 list(APPEND uv_defines
136 list(APPEND uv_sources
138 src/unix/aix-common.c
142 if(CMAKE_SYSTEM_NAME STREQUAL "OS400")
143 list(APPEND uv_headers
146 list(APPEND uv_defines
152 list(APPEND uv_sources
153 src/unix/aix-common.c
155 src/unix/posix-poll.c
156 src/unix/no-fsevents.c
157 src/unix/no-proctitle.c
161 if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
162 list(APPEND uv_libraries
164 list(APPEND uv_headers
167 list(APPEND uv_defines
169 list(APPEND uv_sources
171 src/unix/bsd-ifaddrs.c
172 src/unix/no-fsevents.c
173 src/unix/no-proctitle.c
174 src/unix/posix-hrtime.c
175 src/unix/posix-poll.c
176 src/unix/procfs-exepath.c
177 src/unix/sysinfo-loadavg.c
178 src/unix/sysinfo-memory.c
182 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
183 list(APPEND uv_headers
186 list(APPEND uv_defines
187 _DARWIN_USE_64_BIT_INODE=1
188 _DARWIN_UNLIMITED_SELECT=1
190 list(APPEND uv_sources
191 src/unix/bsd-ifaddrs.c
193 src/unix/darwin-proctitle.c
200 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
201 list(APPEND uv_libraries dl rt)
202 list(APPEND uv_headers
205 list(APPEND uv_defines _GNU_SOURCE)
206 list(APPEND uv_sources
208 src/unix/linux-core.c
209 src/unix/linux-inotify.c
210 src/unix/linux-syscalls.c
211 src/unix/linux-syscalls.h
212 src/unix/procfs-exepath.c
214 src/unix/sysinfo-loadavg.c
215 src/unix/sysinfo-memory.c
219 if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
220 list(APPEND uv_libraries
223 list(APPEND uv_headers
226 list(APPEND uv_sources
227 src/unix/bsd-ifaddrs.c
228 src/unix/bsd-proctitle.c
231 src/unix/posix-hrtime.c
235 if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")
236 list(APPEND uv_libraries
240 list(APPEND uv_headers
243 list(APPEND uv_sources
244 src/unix/bsd-ifaddrs.c
245 src/unix/bsd-proctitle.c
248 src/unix/posix-hrtime.c
252 if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
253 list(APPEND uv_libraries
256 list(APPEND uv_headers
259 list(APPEND uv_sources
260 src/unix/bsd-ifaddrs.c
261 src/unix/bsd-proctitle.c
264 src/unix/posix-hrtime.c
268 if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
269 list(APPEND uv_libraries
272 list(APPEND uv_headers
275 list(APPEND uv_sources
276 src/unix/bsd-ifaddrs.c
277 src/unix/bsd-proctitle.c
280 src/unix/posix-hrtime.c
284 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
285 list(APPEND uv_libraries
292 list(APPEND uv_headers
295 list(APPEND uv_defines
298 if(CMAKE_SYSTEM_VERSION STREQUAL "5.10")
299 set(CMAKE_C_STANDARD 90)
300 if(CMAKE_VERSION VERSION_LESS 3.8.20170504 AND CMAKE_C_COMPILER_ID STREQUAL "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.14)
301 # The running version of CMake does not know how to add this flag.
302 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90")
304 list(APPEND uv_defines
308 if(NOT CMAKE_C_STANDARD OR CMAKE_C_STANDARD EQUAL 90)
309 set(CMAKE_C_STANDARD 11)
311 if(CMAKE_VERSION VERSION_LESS 3.8.20170505 AND CMAKE_C_COMPILER_ID STREQUAL "SunPro" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 5.14)
312 # The running version of CMake does not know how to add this flag.
313 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xc99")
315 list(APPEND uv_defines
319 list(APPEND uv_sources
320 src/unix/no-proctitle.c
325 if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
326 list(APPEND uv_libraries
329 list(APPEND uv_headers
332 list(APPEND uv_defines
333 _XOPEN_SOURCE_EXTENDED
335 list(APPEND uv_sources
337 src/unix/no-fsevents.c
338 src/unix/posix-poll.c
342 if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
343 list(APPEND uv_headers
346 list(APPEND uv_defines
349 list(APPEND uv_sources
350 src/unix/posix-hrtime.c
351 src/unix/posix-poll.c
352 src/unix/no-fsevents.c
353 src/unix/no-proctitle.c
355 list(APPEND uv_libraries
364 add_library(cmlibuv STATIC ${uv_sources})
365 target_link_libraries(cmlibuv ${uv_libraries})
366 set_property(TARGET cmlibuv PROPERTY COMPILE_DEFINITIONS ${uv_defines})
368 install(FILES LICENSE DESTINATION ${CMAKE_DOC_DIR}/cmlibuv)