Skip to content

Commit 17ea56e

Browse files
erw7vtjnash
andauthored
build: Improve build by cmake for Cygwin (libuv#2085)
- Fix build on Cygwin. - Simplify file name of static library. Co-authored-by: Jameson Nash <[email protected]>
1 parent b4440f5 commit 17ea56e

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,20 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
419419
list(APPEND uv_test_libraries util)
420420
endif()
421421

422+
if(CYGWIN OR MSYS)
423+
list(APPEND uv_defines _GNU_SOURCE)
424+
list(APPEND uv_sources
425+
src/unix/cygwin.c
426+
src/unix/bsd-ifaddrs.c
427+
src/unix/no-fsevents.c
428+
src/unix/no-proctitle.c
429+
src/unix/posix-hrtime.c
430+
src/unix/posix-poll.c
431+
src/unix/procfs-exepath.c
432+
src/unix/sysinfo-loadavg.c
433+
src/unix/sysinfo-memory.c)
434+
endif()
435+
422436
if(LIBUV_BUILD_SHARED)
423437
add_library(uv SHARED ${uv_sources})
424438
target_compile_definitions(uv
@@ -439,6 +453,7 @@ if(LIBUV_BUILD_SHARED)
439453
set_target_properties(uv PROPERTIES LINKER_LANGUAGE CXX)
440454
endif()
441455
target_link_libraries(uv ${uv_libraries})
456+
set_target_properties(uv PROPERTIES OUTPUT_NAME "uv")
442457
endif()
443458

444459
add_library(uv_a STATIC ${uv_sources})
@@ -455,6 +470,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS390")
455470
set_target_properties(uv_a PROPERTIES LINKER_LANGUAGE CXX)
456471
endif()
457472
target_link_libraries(uv_a ${uv_libraries})
473+
set_target_properties(uv_a PROPERTIES OUTPUT_NAME "uv")
474+
if(MSVC)
475+
set_target_properties(uv_a PROPERTIES PREFIX "lib")
476+
endif()
458477

459478
if(LIBUV_BUILD_TESTS)
460479
# Small hack: use ${uv_test_sources} now to get the runner skeleton,

libuv-static.pc.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ Version: @PACKAGE_VERSION@
88
Description: multi-platform support library with a focus on asynchronous I/O.
99
URL: http://libuv.org/
1010

11-
Libs: -L${libdir} -luv_a @LIBS@
11+
Libs: -L${libdir} -l:libuv.a @LIBS@
1212
Cflags: -I${includedir}

libuv.pc.in

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ prefix=@prefix@
22
exec_prefix=${prefix}
33
libdir=@libdir@
44
includedir=@includedir@
5+
LIBUV_STATIC=-L${libdir} -l:libuv.a @LIBS@
56

67
Name: libuv
78
Version: @PACKAGE_VERSION@

0 commit comments

Comments
 (0)