From 2ad3ae7b50f4dff42d16e10f1f1e13f2d6362e39 Mon Sep 17 00:00:00 2001 From: "Berk D. Demir" Date: Sat, 22 Apr 2023 17:56:19 -0700 Subject: [PATCH] Add CMake installation support Allows installation with: `cmake --install . [--prefix /dir]` --- CMakeLists.txt | 12 ++++++++++-- tools/blisp/CMakeLists.txt | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c369de..105a4f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,16 +17,22 @@ set_property(TARGET libblisp_obj PROPERTY POSITION_INDEPENDENT_CODE 1) add_library(libblisp SHARED $) add_library(libblisp_static STATIC $) +set(BLISP_PUBLIC_HEADERS + include/blisp.h + include/blisp_easy.h + include/blisp_chip.h + include/blisp_struct.h + include/blisp_util.h) set_target_properties(libblisp PROPERTIES - PUBLIC_HEADER "include/blisp.h" + PUBLIC_HEADER "${BLISP_PUBLIC_HEADERS}" VERSION 0.0.3 SOVERSION 1 LIBRARY_OUTPUT_DIRECTORY "shared" OUTPUT_NAME "blisp") set_target_properties(libblisp_static PROPERTIES - PUBLIC_HEADER "include/blisp.h" + PUBLIC_HEADER "${BLISP_PUBLIC_HEADERS}" VERSION 0.0.3 SOVERSION 1 ARCHIVE_OUTPUT_DIRECTORY "static" @@ -74,6 +80,8 @@ elseif(APPLE) write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.") endif() +install(TARGETS libblisp libblisp_static DESTINATION lib) + if(BLISP_BUILD_CLI) add_subdirectory(tools/blisp) endif() diff --git a/tools/blisp/CMakeLists.txt b/tools/blisp/CMakeLists.txt index ce38714..fb56976 100644 --- a/tools/blisp/CMakeLists.txt +++ b/tools/blisp/CMakeLists.txt @@ -17,4 +17,6 @@ if (WIN32) target_link_libraries(blisp PRIVATE Setupapi.lib) elseif (APPLE) target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation") -endif () \ No newline at end of file +endif () + +install(TARGETS blisp DESTINATION bin)