1
0
mirror of https://github.com/libuv/libuv synced 2025-03-28 21:13:16 +00:00

build: export USING_UV_SHARED=1 to cmake deps

Build the shared library with `BUILDING_UV_SHARED=1` and export
`USING_UV_SHARED=1` to dependents so they get the right declspec.

Fixes: https://github.com/libuv/libuv/issues/1938
PR-URL: https://github.com/libuv/libuv/pull/2431
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
Ben Noordhuis 2019-09-06 10:07:13 +02:00
parent be449a1979
commit 6325a7c840
2 changed files with 7 additions and 1 deletions

View File

@ -343,7 +343,9 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD")
endif()
add_library(uv SHARED ${uv_sources})
target_compile_definitions(uv PRIVATE ${uv_defines} BUILDING_UV_SHARED=1)
target_compile_definitions(uv
INTERFACE USING_UV_SHARED=1
PRIVATE ${uv_defines} BUILDING_UV_SHARED=1)
target_compile_options(uv PRIVATE ${uv_cflags})
target_include_directories(uv PUBLIC include PRIVATE src)
target_link_libraries(uv ${uv_libraries})

View File

@ -27,6 +27,10 @@
extern "C" {
#endif
#if defined(BUILDING_UV_SHARED) && defined(USING_UV_SHARED)
#error "Define either BUILDING_UV_SHARED or USING_UV_SHARED, not both."
#endif
#ifdef _WIN32
/* Windows - set up dll import/export decorators. */
# if defined(BUILDING_UV_SHARED)