Skip to content

Commit 07fa625

Browse files
authored
Merge pull request #2065 from afrind/fix-install-interface-include-dirs
Fix installed picoquic-core target missing INTERFACE_INCLUDE_DIRECTORIES
2 parents 9120b1f + 11dcb90 commit 07fa625

4 files changed

Lines changed: 48 additions & 8 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ endif()
629629

630630
install(TARGETS picoquic-core
631631
EXPORT picoquic-targets
632-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
632+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
633+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
633634

634635
if(PICOQUIC_FETCH_PTLS)
635636
set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/libpicoquic-core.a")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project(install_test LANGUAGES C)
3+
4+
# Validate that an installed picoquic exports INTERFACE_INCLUDE_DIRECTORIES so
5+
# that consumers can #include <picoquic.h> without manually specifying the path.
6+
find_package(picoquic REQUIRED)
7+
8+
add_executable(install_test main.c)
9+
target_link_libraries(install_test PRIVATE picoquic::picoquic-core)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <picoquic.h>
2+
#include <stdio.h>
3+
4+
int main(void)
5+
{
6+
printf("picoquic version: %s\n", PICOQUIC_VERSION);
7+
return 0;
8+
}

ci/embedding-test/run.sh

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,46 @@ PICOQUIC_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
1919
shift 1 2>/dev/null || true
2020

2121
BUILD_DIR="$(mktemp -d)"
22-
INSTALL_PREFIX="$(mktemp -d)"
23-
trap 'rm -rf "$BUILD_DIR" "$INSTALL_PREFIX"' EXIT
22+
FETCHCONTENT_INSTALL="$(mktemp -d)"
23+
STANDALONE_INSTALL="$(mktemp -d)"
24+
trap 'rm -rf "$BUILD_DIR" "$FETCHCONTENT_INSTALL" "$STANDALONE_INSTALL"' EXIT
2425

26+
# --- Standalone install test ---
27+
# Validates that an installed picoquic (as getdeps does it) correctly exports
28+
# INTERFACE_INCLUDE_DIRECTORIES so consumers can #include <picoquic.h>.
29+
echo "==> Building and installing picoquic standalone"
30+
cmake -S "$PICOQUIC_ROOT" -B "$BUILD_DIR/picoquic" \
31+
-DPICOQUIC_FETCH_PTLS=ON \
32+
-DCMAKE_INSTALL_PREFIX="$STANDALONE_INSTALL" \
33+
-DCMAKE_BUILD_TYPE=Release \
34+
-DBUILD_TESTING=OFF \
35+
"$@"
36+
cmake --build "$BUILD_DIR/picoquic"
37+
cmake --install "$BUILD_DIR/picoquic"
38+
39+
echo "==> Building and running install_test against standalone install"
40+
cmake -S "$SCRIPT_DIR/install_test" -B "$BUILD_DIR/install_test" \
41+
-DCMAKE_PREFIX_PATH="$STANDALONE_INSTALL" \
42+
-DCMAKE_BUILD_TYPE=Release
43+
cmake --build "$BUILD_DIR/install_test"
44+
"$BUILD_DIR/install_test/install_test"
45+
46+
# --- FetchContent re-export test ---
47+
# Validates that a library embedding picoquic via FetchContent correctly
48+
# re-exports it to downstream consumers.
2549
echo "==> Building and installing sample_lib (picoquic root: $PICOQUIC_ROOT)"
2650
cmake -S "$SCRIPT_DIR/sample_lib" -B "$BUILD_DIR/sample_lib" \
2751
-DFETCHCONTENT_SOURCE_DIR_PICOQUIC="$PICOQUIC_ROOT" \
2852
-DPICOQUIC_FETCH_PTLS=ON \
29-
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
53+
-DCMAKE_INSTALL_PREFIX="$FETCHCONTENT_INSTALL" \
3054
-DCMAKE_BUILD_TYPE=Release \
3155
"$@"
3256
cmake --build "$BUILD_DIR/sample_lib"
3357
cmake --install "$BUILD_DIR/sample_lib"
3458

35-
echo "==> Building sample_app"
59+
echo "==> Building and running sample_app"
3660
cmake -S "$SCRIPT_DIR/sample_app" -B "$BUILD_DIR/sample_app" \
37-
-DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
61+
-DCMAKE_PREFIX_PATH="$FETCHCONTENT_INSTALL" \
3862
-DCMAKE_BUILD_TYPE=Release
3963
cmake --build "$BUILD_DIR/sample_app"
40-
41-
echo "==> Running sample_app"
4264
"$BUILD_DIR/sample_app/sample_app"

0 commit comments

Comments
 (0)