2023-02-26 14:32:08 -07:00
|
|
|
find_path(LIBUV_INCLUDE_DIR uv.h)
|
2014-02-26 10:36:06 -07:00
|
|
|
|
2023-02-16 14:09:05 -07:00
|
|
|
list(APPEND LIBUV_NAMES uv_a uv)
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2023-02-26 14:32:08 -07:00
|
|
|
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES})
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2023-02-26 14:32:08 -07:00
|
|
|
set(LIBUV_LIBRARIES ${LIBUV_LIBRARY})
|
2014-03-03 08:09:06 -07:00
|
|
|
set(LIBUV_INCLUDE_DIRS ${LIBUV_INCLUDE_DIR})
|
|
|
|
|
2014-03-09 05:40:55 -07:00
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
|
|
|
check_library_exists(dl dlopen "dlfcn.h" HAVE_LIBDL)
|
|
|
|
if(HAVE_LIBDL)
|
|
|
|
list(APPEND LIBUV_LIBRARIES dl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(kstat kstat_lookup "kstat.h" HAVE_LIBKSTAT)
|
|
|
|
if(HAVE_LIBKSTAT)
|
|
|
|
list(APPEND LIBUV_LIBRARIES kstat)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(kvm kvm_open "kvm.h" HAVE_LIBKVM)
|
2017-05-03 11:16:06 -07:00
|
|
|
if(HAVE_LIBKVM AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
2014-03-09 05:40:55 -07:00
|
|
|
list(APPEND LIBUV_LIBRARIES kvm)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(nsl gethostbyname "nsl.h" HAVE_LIBNSL)
|
|
|
|
if(HAVE_LIBNSL)
|
|
|
|
list(APPEND LIBUV_LIBRARIES nsl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(perfstat perfstat_cpu "libperfstat.h" HAVE_LIBPERFSTAT)
|
|
|
|
if(HAVE_LIBPERFSTAT)
|
|
|
|
list(APPEND LIBUV_LIBRARIES perfstat)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(rt clock_gettime "time.h" HAVE_LIBRT)
|
|
|
|
if(HAVE_LIBRT)
|
|
|
|
list(APPEND LIBUV_LIBRARIES rt)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_library_exists(sendfile sendfile "" HAVE_LIBSENDFILE)
|
|
|
|
if(HAVE_LIBSENDFILE)
|
|
|
|
list(APPEND LIBUV_LIBRARIES sendfile)
|
|
|
|
endif()
|
|
|
|
|
2015-09-23 15:31:39 -07:00
|
|
|
if(WIN32)
|
|
|
|
# check_library_exists() does not work for Win32 API calls in X86 due to name
|
|
|
|
# mangling calling conventions
|
|
|
|
list(APPEND LIBUV_LIBRARIES iphlpapi)
|
|
|
|
list(APPEND LIBUV_LIBRARIES psapi)
|
2015-06-08 13:54:34 -07:00
|
|
|
list(APPEND LIBUV_LIBRARIES userenv)
|
|
|
|
list(APPEND LIBUV_LIBRARIES ws2_32)
|
|
|
|
endif()
|
|
|
|
|
2021-09-21 03:56:25 -07:00
|
|
|
find_package(Threads)
|
2021-09-20 16:35:35 -07:00
|
|
|
if(Threads_FOUND)
|
|
|
|
# TODO: Fix the cmake file to properly handle static deps for bundled builds.
|
|
|
|
# Meanwhile just include the threads library if CMake tells us there's one to
|
|
|
|
# use.
|
|
|
|
list(APPEND LIBUV_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
endif()
|
|
|
|
|
2023-03-02 14:50:43 -07:00
|
|
|
find_package_handle_standard_args(Libuv DEFAULT_MSG
|
2014-03-03 08:09:06 -07:00
|
|
|
LIBUV_LIBRARY LIBUV_INCLUDE_DIR)
|
|
|
|
|
|
|
|
mark_as_advanced(LIBUV_INCLUDE_DIR LIBUV_LIBRARY)
|