From eac4bfd3228afe3c500b371e7039cb321ac8e3b1 Mon Sep 17 00:00:00 2001 From: Christoph Fritz Date: Sat, 1 Apr 2023 21:10:23 +0200 Subject: [PATCH] uv: cmake: avoid using full host path When using OE/Yocto to create a SDK/toolchain, the generated LibwebsocketsTargets.cmake falsely contains the host path (build artifacts) in INTERFACE_LINK_LIBRARIES instead of the actually installed SDK path. This host path originates from LIBUV_LIBRARIES that gives the full path to the openssl library at build time. To avoid propagating full build host specific path to generated LibwebsocketsTargets.cmake, this patch is using pkg_check_modules(). --- lib/event-libs/libuv/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/event-libs/libuv/CMakeLists.txt b/lib/event-libs/libuv/CMakeLists.txt index 28460b3c1..5f9aa5d14 100644 --- a/lib/event-libs/libuv/CMakeLists.txt +++ b/lib/event-libs/libuv/CMakeLists.txt @@ -36,7 +36,9 @@ set(LWS_LIBUV_INCLUDE_DIRS CACHE PATH "Path to the libuv include directory") if ("${LWS_LIBUV_LIBRARIES}" STREQUAL "" OR "${LWS_LIBUV_INCLUDE_DIRS}" STREQUAL "") if (NOT LIBUV_FOUND) find_path(LIBUV_INCLUDE_DIRS NAMES uv.h) - find_library(LIBUV_LIBRARIES NAMES uv) + find_package(PkgConfig) + pkg_check_modules(LUV REQUIRED IMPORTED_TARGET libuv) + set(LIBUV_LIBRARIES ${LUV_LIBRARIES}) endif() else() set(LIBUV_LIBRARIES ${LWS_LIBUV_LIBRARIES})