From 68dec1885c571091026989c16abcd82adda90aaf Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 2 Dec 2025 16:48:44 +0100 Subject: [PATCH 1/5] Use Cmake targets Signed-off-by: Uilian Ries --- CMakeLists.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f531b2..5b23b39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,19 +8,13 @@ option(LIFT_BUILD_TESTS "Build the tests. Default=ON" ON) option(LIFT_CODE_COVERAGE "Enable code coverage, tests must also be enabled. Default=OFF" OFF) option(LIFT_RUN_GITCONFIG "Set the githooks directory to auto format code and update the readme, Default=OFF." OFF) -if(NOT DEFINED LIFT_USER_LINK_LIBRARIES) - set( - LIFT_USER_LINK_LIBRARIES - curl z uv pthread dl stdc++fs - CACHE STRING - "Override ${PROJECT_NAME} required link libraries, defaults to [curl z uv pthread dl stdc++fs]. If changed all defaults must be accounted for manually." - ) -endif() +find_package(CURL REQUIRED) +find_package(libuv REQUIRED) +find_package(Threads REQUIRED) message("${PROJECT_NAME} LIFT_BUILD_EXAMPLES = ${LIFT_BUILD_EXAMPLES}") message("${PROJECT_NAME} LIFT_BUILD_TESTS = ${LIFT_BUILD_TESTS}") message("${PROJECT_NAME} LIFT_CODE_COVERAGE = ${LIFT_CODE_COVERAGE}") -message("${PROJECT_NAME} LIFT_USER_LINK_LIBRARIES = ${LIFT_USER_LINK_LIBRARIES}") message("${PROJECT_NAME} LIFT_RUN_GITCONFIG = ${LIFT_RUN_GITCONFIG}") if (LIFT_RUN_GITCONFIG) @@ -37,6 +31,9 @@ if(MSVC) add_definitions(-DNOMINMAX) endif() +# LibUV >=1.45 introduced an imported target 'libuv::uv' +set(LIBUV_TARGET $,libuv::uv,uv>) + set(LIBLIFTHTTP_SOURCE_FILES inc/lift/impl/copy_util.hpp inc/lift/impl/pragma.hpp @@ -64,8 +61,7 @@ target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${LIFT_CURL_INCLUDE}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) - -target_link_libraries(${PROJECT_NAME} PUBLIC ${LIFT_USER_LINK_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PUBLIC CURL::libcurl ${LIBUV_TARGET} Threads::Threads) if(LIFT_CODE_COVERAGE) if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") From 21444d15d43337a6d4000b04d0d0fc0fc42a5231 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 19 Dec 2025 08:48:13 +0100 Subject: [PATCH 2/5] Add fallback for libuv with pkgconfig Signed-off-by: Uilian Ries --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85d649a..1e367f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,20 @@ option(LIFT_CODE_COVERAGE "Enable code coverage, tests must also be enabled. De option(LIFT_RUN_GITCONFIG "Set the githooks directory to auto format code and update the readme, Default=OFF." OFF) find_package(CURL REQUIRED) -find_package(libuv REQUIRED) +find_package(libuv CONFIG QUIET) find_package(Threads REQUIRED) +set(LIBUV_TARGET "") +# LibUV >=1.45 introduced an imported target 'libuv::uv' +if(TARGET libuv::uv) + set(LIBUV_TARGET libuv::uv) +else() + find_package(PkgConfig REQUIRED) + # Fallback to pkg-config if libuv CMake config is not found + pkg_check_modules(LIBUV REQUIRED IMPORTED_TARGET libuv) + set(LIBUV_TARGET PkgConfig::LIBUV) +endif() + message("${PROJECT_NAME} LIFT_BUILD_EXAMPLES = ${LIFT_BUILD_EXAMPLES}") message("${PROJECT_NAME} LIFT_BUILD_TESTS = ${LIFT_BUILD_TESTS}") message("${PROJECT_NAME} LIFT_CODE_COVERAGE = ${LIFT_CODE_COVERAGE}") From c87855a27b674b13b95e6d309b6e0cb76743ef18 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 19 Dec 2025 08:52:09 +0100 Subject: [PATCH 3/5] Remove libuv target override Signed-off-by: Uilian Ries --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e367f5..0f61daf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,9 +42,6 @@ if(MSVC) add_definitions(-DNOMINMAX) endif() -# LibUV >=1.45 introduced an imported target 'libuv::uv' -set(LIBUV_TARGET $,libuv::uv,uv>) - set(LIBLIFTHTTP_SOURCE_FILES inc/lift/impl/copy_util.hpp inc/lift/impl/pragma.hpp From 20b71d7197a75cfca7063a6bb2e627cc564fa0cd Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 19 Dec 2025 08:58:28 +0100 Subject: [PATCH 4/5] Install pkg-config in the CI Signed-off-by: Uilian Ries --- .github/workflows/ci-coverage.yml | 3 ++- .github/workflows/ci-fedora.yml | 6 ++++-- .github/workflows/ci-ubuntu.yml | 9 ++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-coverage.yml b/.github/workflows/ci-coverage.yml index 6a2e61e..915aaf5 100644 --- a/.github/workflows/ci-coverage.yml +++ b/.github/workflows/ci-coverage.yml @@ -34,7 +34,8 @@ jobs: libcurl4-openssl-dev \ libuv1-dev \ curl \ - lcov + lcov \ + pkg-config - name: check-haproxy run: | curl -v --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html" diff --git a/.github/workflows/ci-fedora.yml b/.github/workflows/ci-fedora.yml index 4bb501a..c447082 100644 --- a/.github/workflows/ci-fedora.yml +++ b/.github/workflows/ci-fedora.yml @@ -30,7 +30,8 @@ jobs: libcurl-devel \ libuv-devel \ iputils \ - curl + curl \ + pkgconf-pkg-config - name: ping run: | ping -c1 nginx @@ -80,7 +81,8 @@ jobs: libcurl-devel \ libuv-devel \ iputils \ - curl + curl \ + pkgconf-pkg-config - name: ping run: | ping -c1 nginx diff --git a/.github/workflows/ci-ubuntu.yml b/.github/workflows/ci-ubuntu.yml index edc8eb0..f87f72d 100644 --- a/.github/workflows/ci-ubuntu.yml +++ b/.github/workflows/ci-ubuntu.yml @@ -36,7 +36,8 @@ jobs: zlib1g-dev \ libcurl4-openssl-dev \ libuv1-dev \ - curl + curl \ + pkg-config - name: check-haproxy run: | curl -v --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html" @@ -231,7 +232,8 @@ jobs: zlib1g-dev \ libcurl4-openssl-dev \ libuv1-dev \ - curl + curl \ + pkg-config - name: check-haproxy run: | curl -v --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html" @@ -288,7 +290,8 @@ jobs: zlib1g-dev \ libcurl4-openssl-dev \ libuv1-dev \ - curl + curl \ + pkg-config - name: check-haproxy run: | curl -v --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html" From 7fcae85ebc01b1a98b0cd82b056af1f0cd6710a7 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 19 Dec 2025 09:01:06 +0100 Subject: [PATCH 5/5] Install pkg-config in the CI - 2 Signed-off-by: Uilian Ries --- .github/workflows/ci-ubuntu.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-ubuntu.yml b/.github/workflows/ci-ubuntu.yml index f87f72d..c06321b 100644 --- a/.github/workflows/ci-ubuntu.yml +++ b/.github/workflows/ci-ubuntu.yml @@ -94,7 +94,8 @@ jobs: zlib1g-dev \ libcurl4-openssl-dev \ libuv1-dev \ - curl + curl \ + pkg-config - name: check-haproxy run: | curl -v --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html" @@ -149,7 +150,8 @@ jobs: libssl-dev \ libuv1-dev \ curl \ - wget + wget \ + pkg-config - name: check-haproxy run: | curl --user guest:guestpassword -x "http://haproxy:3128" "http://nginx/index.html"