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
34 src/uv-data-getter-setters.c
38 list(APPEND uv_libraries
45 list(APPEND uv_includes
48 list(APPEND uv_defines
52 list(APPEND uv_headers
56 list(APPEND uv_sources
58 src/win/atomicops-inl.h
60 src/win/detect-wakeup.c
70 src/win/loop-watcher.c
73 src/win/process-stdio.c
91 list(APPEND uv_includes
94 list(APPEND uv_headers
97 list(APPEND uv_sources
103 src/unix/getaddrinfo.c
104 src/unix/getnameinfo.c
106 src/unix/loop-watcher.c
121 if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
122 list(APPEND uv_libraries
125 list(APPEND uv_headers
128 list(APPEND uv_defines
134 list(APPEND uv_sources
136 src/unix/aix-common.c
140 if(CMAKE_SYSTEM_NAME STREQUAL "OS400")
141 list(APPEND uv_headers
144 list(APPEND uv_defines
150 list(APPEND uv_sources
151 src/unix/aix-common.c
153 src/unix/posix-poll.c
154 src/unix/no-fsevents.c
155 src/unix/no-proctitle.c
159 if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS")
160 list(APPEND uv_libraries
162 list(APPEND uv_headers
165 list(APPEND uv_defines
167 list(APPEND uv_sources
169 src/unix/bsd-ifaddrs.c
170 src/unix/no-fsevents.c
171 src/unix/no-proctitle.c
172 src/unix/posix-hrtime.c
173 src/unix/posix-poll.c
174 src/unix/procfs-exepath.c
175 src/unix/sysinfo-loadavg.c
176 src/unix/sysinfo-memory.c
180 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
181 list(APPEND uv_headers
184 list(APPEND uv_defines
185 _DARWIN_USE_64_BIT_INODE=1
186 _DARWIN_UNLIMITED_SELECT=1
188 list(APPEND uv_sources
189 src/unix/bsd-ifaddrs.c
191 src/unix/darwin-proctitle.c
198 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
199 list(APPEND uv_libraries dl rt)
200 list(APPEND uv_headers
203 list(APPEND uv_defines _GNU_SOURCE)
204 list(APPEND uv_sources
206 src/unix/linux-core.c
207 src/unix/linux-inotify.c
208 src/unix/linux-syscalls.c
209 src/unix/linux-syscalls.h
210 src/unix/procfs-exepath.c
212 src/unix/sysinfo-loadavg.c
213 src/unix/sysinfo-memory.c
217 if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
218 list(APPEND uv_libraries
221 list(APPEND uv_headers
224 list(APPEND uv_sources
225 src/unix/bsd-ifaddrs.c
226 src/unix/bsd-proctitle.c
229 src/unix/posix-hrtime.c
233 if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")
234 list(APPEND uv_libraries
238 list(APPEND uv_headers
241 list(APPEND uv_sources
242 src/unix/bsd-ifaddrs.c
243 src/unix/bsd-proctitle.c
246 src/unix/posix-hrtime.c
250 if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
251 list(APPEND uv_libraries
254 list(APPEND uv_headers
257 list(APPEND uv_sources
258 src/unix/bsd-ifaddrs.c
259 src/unix/bsd-proctitle.c
262 src/unix/posix-hrtime.c
266 if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
267 list(APPEND uv_libraries
270 list(APPEND uv_headers
273 list(APPEND uv_sources
274 src/unix/bsd-ifaddrs.c
275 src/unix/bsd-proctitle.c
278 src/unix/posix-hrtime.c
282 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
283 list(APPEND uv_libraries
290 list(APPEND uv_headers
293 list(APPEND uv_defines
296 if(CMAKE_SYSTEM_VERSION STREQUAL "5.10")
297 set(CMAKE_C_STANDARD 90)
298 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)
299 # The running version of CMake does not know how to add this flag.
300 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c90")
302 list(APPEND uv_defines
306 if(NOT CMAKE_C_STANDARD OR CMAKE_C_STANDARD EQUAL 90)
307 set(CMAKE_C_STANDARD 11)
309 if(CMAKE_VERSION VERSION_LESS 3.8.20170505 AND CMAKE_C_COMPILER_ID STREQUAL "SunPro" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 5.14)
310 # The running version of CMake does not know how to add this flag.
311 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -xc99")
313 list(APPEND uv_defines
317 list(APPEND uv_sources
318 src/unix/no-proctitle.c
323 if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
324 list(APPEND uv_libraries
327 list(APPEND uv_headers
330 list(APPEND uv_defines
331 _XOPEN_SOURCE_EXTENDED
333 list(APPEND uv_sources
335 src/unix/no-fsevents.c
336 src/unix/posix-poll.c
340 if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
341 list(APPEND uv_headers
344 list(APPEND uv_defines
347 list(APPEND uv_sources
348 src/unix/posix-hrtime.c
349 src/unix/posix-poll.c
350 src/unix/no-fsevents.c
351 src/unix/no-proctitle.c
353 list(APPEND uv_libraries
362 add_library(cmlibuv STATIC ${uv_sources})
363 target_link_libraries(cmlibuv ${uv_libraries})
364 set_property(TARGET cmlibuv PROPERTY COMPILE_DEFINITIONS ${uv_defines})
366 install(FILES LICENSE DESTINATION ${CMAKE_DOC_DIR}/cmlibuv)