mirror of
https://github.com/neovim/neovim.git
synced 2024-12-22 04:05:09 -07:00
f8eae29d39
When libluv is built statically it appends an '_a' suffix to the library name. This affects CMake's ability to find the bundled version of libluv (which is built statically) when there is a dynamic version of the library also built on the system, which does not have the '_a' suffix. Prioritize searching for 'libluv_a' first before falling back to 'libluv'. This will ensure the bundled version of libluv is always found first before any system versions of libluv. In cases where we are not using bundled libraries, CMake will still safely fall through to finding 'libluv' since package managers do not typically provide static system libraries.
33 lines
1.0 KiB
CMake
33 lines
1.0 KiB
CMake
# - Try to find luv
|
|
# Once done this will define
|
|
# LIBLUV_FOUND - System has libluv
|
|
# LIBLUV_INCLUDE_DIRS - The libluv include directories
|
|
# LIBLUV_LIBRARIES - The libraries needed to use libluv
|
|
|
|
find_package(PkgConfig)
|
|
if (PKG_CONFIG_FOUND)
|
|
pkg_check_modules(PC_LIBLUV QUIET luv)
|
|
endif()
|
|
|
|
set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
|
|
|
|
find_path(LIBLUV_INCLUDE_DIR luv/luv.h
|
|
PATHS ${PC_LIBLUV_INCLUDEDIR} ${PC_LIBLUV_INCLUDE_DIRS})
|
|
|
|
# Explicitly look for luv.so. #10407
|
|
list(APPEND LIBLUV_NAMES luv_a luv libluv_a luv${CMAKE_SHARED_LIBRARY_SUFFIX})
|
|
|
|
find_library(LIBLUV_LIBRARY NAMES ${LIBLUV_NAMES}
|
|
HINTS ${PC_LIBLUV_LIBDIR} ${PC_LIBLUV_LIBRARY_DIRS})
|
|
|
|
set(LIBLUV_LIBRARIES ${LIBLUV_LIBRARY})
|
|
set(LIBLUV_INCLUDE_DIRS ${LIBLUV_INCLUDE_DIR})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
# handle the QUIETLY and REQUIRED arguments and set LIBLUV_FOUND to TRUE
|
|
# if all listed variables are TRUE
|
|
find_package_handle_standard_args(LibLUV DEFAULT_MSG
|
|
LIBLUV_LIBRARY LIBLUV_INCLUDE_DIR)
|
|
|
|
mark_as_advanced(LIBLUV_INCLUDE_DIR LIBLUV_LIBRARY)
|