mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
build: use libuv config file (#22209)
Libuv's recent changes in their pc file breaks cmake; they are using -l:libuv.a for the linker, and it seems cmake can't resolve that. Prefer using their cmake config file instead instead, and use the find module as a fall-back in case it fails. Closes https://github.com/neovim/neovim/issues/22271.
This commit is contained in:
parent
bb377afd32
commit
6dfabd0145
@ -13,7 +13,7 @@ endif()
|
||||
find_path(LIBUV_INCLUDE_DIR uv.h
|
||||
HINTS ${PC_LIBUV_INCLUDEDIR} ${PC_LIBUV_INCLUDE_DIRS})
|
||||
|
||||
list(APPEND LIBUV_NAMES uv_a uv libuv)
|
||||
list(APPEND LIBUV_NAMES uv_a uv)
|
||||
|
||||
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
|
||||
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS})
|
||||
|
@ -2,9 +2,15 @@ add_library(main_lib INTERFACE)
|
||||
add_executable(nvim main.c)
|
||||
|
||||
add_library(libuv_lib INTERFACE)
|
||||
find_package(LibUV 1.28.0 REQUIRED)
|
||||
target_include_directories(libuv_lib SYSTEM BEFORE INTERFACE ${LIBUV_INCLUDE_DIRS})
|
||||
target_link_libraries(libuv_lib INTERFACE ${LIBUV_LIBRARIES})
|
||||
find_package(libuv CONFIG)
|
||||
if(TARGET libuv::uv_a)
|
||||
target_link_libraries(libuv_lib INTERFACE libuv::uv_a)
|
||||
else()
|
||||
# Fallback to find module for older libuv versions, that don't provide the cmake package
|
||||
find_package(LibUV 1.28.0 REQUIRED MODULE)
|
||||
target_include_directories(libuv_lib SYSTEM BEFORE INTERFACE ${LIBUV_INCLUDE_DIRS})
|
||||
target_link_libraries(libuv_lib INTERFACE ${LIBUV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
find_package(Msgpack 1.0.0 REQUIRED)
|
||||
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIRS})
|
||||
|
Loading…
Reference in New Issue
Block a user