From 966c52fc789709638d21a68a26c9870f5b0a7eca Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Thu, 1 Oct 2020 14:45:41 +0200 Subject: [PATCH] Add CMake install target (#171) --- CMakeLists.txt | 9 +++++++++ src/liblsquic/CMakeLists.txt | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2515653..47f1299 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ OPTION(LSQUIC_BIN "Compile example binaries that use the library" ON) OPTION(LSQUIC_TESTS "Compile library unit tests" ON) OPTION(LSQUIC_SHARED_LIB "Compile as shared librarry" OFF) +INCLUDE(GNUInstallDirs) + IF (CMAKE_SYSTEM_NAME STREQUAL "Linux") # If using older glibc, need to link with -lrt. See clock_getres(2). EXECUTE_PROCESS( @@ -336,3 +338,10 @@ IF(SPHINX) ELSE() MESSAGE(STATUS "sphinx-build not found: docs won't be made") ENDIF() + +INSTALL(FILES + include/lsquic.h + include/lsquic_types.h + include/lsxpack_header.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lsquic +) diff --git a/src/liblsquic/CMakeLists.txt b/src/liblsquic/CMakeLists.txt index a8ee083..7de53b2 100644 --- a/src/liblsquic/CMakeLists.txt +++ b/src/liblsquic/CMakeLists.txt @@ -115,3 +115,9 @@ ELSE() add_library(lsquic STATIC ${lsquic_STAT_SRCS}) ENDIF() +install(TARGETS lsquic + EXPORT lsquic-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +