Skip to content

Commit 3519c92

Browse files
committed
Export picoquic-core as picoquic::picoquic-core installed target
Add a picoquic::picoquic-core alias and include picoquic-core and picotls libraries in an installed CMake export set. This allows parent projects that embed picoquic via FetchContent to link against the namespaced target and re-export it cleanly to their own consumers.
1 parent b56ef6b commit 3519c92

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ endmacro()
385385

386386
add_library(picoquic-core ${PICOQUIC_CORE_HEADERS} ${PICOQUIC_LIBRARY_FILES})
387387
target_sources(picoquic-core PRIVATE ${PICOQUIC_CORE_HEADERS_PRIVATE})
388+
add_library(picoquic::picoquic-core ALIAS picoquic-core)
388389

389390
message(STATUS "Defining picoquic-core")
390391
message(STATUS "mbedtls/include: ${MBEDTLS_INCLUDE_DIRS}")
@@ -616,6 +617,7 @@ endif()
616617

617618

618619
install(TARGETS picoquic-core
620+
EXPORT picoquic-targets
619621
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
620622

621623
if(PICOQUIC_FETCH_PTLS)
@@ -626,11 +628,17 @@ if(PICOQUIC_FETCH_PTLS)
626628
set(LIB_PATH "${LIB_PATH}" CACHE PATH "Path of library files")
627629

628630
install(TARGETS ${PTLS_LIBRARIES}
631+
EXPORT picoquic-targets
629632
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
630633
else()
631634
set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/libpicoquic-core.a" CACHE PATH "Path of library file")
632635
endif()
633636

637+
install(EXPORT picoquic-targets
638+
FILE picoquic-targets.cmake
639+
NAMESPACE picoquic::
640+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/picoquic)
641+
634642
install(FILES
635643
${PICOQUIC_CORE_HEADERS}
636644
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

0 commit comments

Comments
 (0)