diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 650abcb..d2e14ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,17 @@ jobs: - name: Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + run: > + cmake --build ${{ steps.strings.outputs.build-output-dir }} + --config ${{ matrix.build_type }} + + - name: Install + run: > + cmake --install ${{ steps.strings.outputs.build-output-dir }} + --prefix ${{ steps.strings.outputs.build-output-dir }}/dist + --config ${{ matrix.build_type }} + --component benoni + --verbose - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d40d0a..e41230f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,20 @@ elseif(UNIX) add_subdirectory(src/linux) endif() +set_target_properties(benoni PROPERTIES PUBLIC_HEADER include/benoni/http.h) + +include(GNUInstallDirs) + +install(TARGETS benoni + EXPORT benoni + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}" + COMPONENT benoni + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT benoni) +install(EXPORT benoni + DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake" + COMPONENT benoni) + if(BENONI_EXAMPLES) add_subdirectory(examples) endif() diff --git a/Makefile b/Makefile index 3954940..681fa7c 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ configure: .always build: .always $(CLANG_FORMAT) --style=file -i include/benoni/http.h src/apple/http.mm src/win32/http.cc src/linux/http.cc examples/http_example.cc test/unit/postman-echo-get.cc test/packaging/project/project.cc $(CMAKE) --build build + $(CMAKE) --install build --prefix build/dist --config Debug --component benoni --verbose example: .always $(EXAMPLE) diff --git a/src/apple/CMakeLists.txt b/src/apple/CMakeLists.txt index e9806c0..4b5e61c 100644 --- a/src/apple/CMakeLists.txt +++ b/src/apple/CMakeLists.txt @@ -2,6 +2,8 @@ add_library(benoni STATIC http.mm) target_compile_options(benoni PUBLIC "-fobjc-arc") -target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include") +target_include_directories(benoni PUBLIC + $ + $) target_link_libraries(benoni PUBLIC "-framework Foundation") diff --git a/src/linux/CMakeLists.txt b/src/linux/CMakeLists.txt index ab57e7a..7fdba20 100644 --- a/src/linux/CMakeLists.txt +++ b/src/linux/CMakeLists.txt @@ -1,5 +1,7 @@ add_library(benoni STATIC http.cc) -target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include") +target_include_directories(benoni PUBLIC + $ + $) target_link_libraries(benoni PUBLIC libsoup) diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt index 2099d10..c8c42b8 100644 --- a/src/win32/CMakeLists.txt +++ b/src/win32/CMakeLists.txt @@ -1,5 +1,7 @@ add_library(benoni STATIC http.cc) -target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include") +target_include_directories(benoni PUBLIC + $ + $) target_link_libraries(benoni PUBLIC "Winhttp.lib")