Add CMake installation support

Allows installation with:
  `cmake --install . [--prefix /dir]`
This commit is contained in:
Berk D. Demir 2023-04-22 17:56:19 -07:00
parent de4a9cd5e6
commit 2ad3ae7b50
2 changed files with 13 additions and 3 deletions

View File

@ -17,16 +17,22 @@ set_property(TARGET libblisp_obj PROPERTY POSITION_INDEPENDENT_CODE 1)
add_library(libblisp SHARED $<TARGET_OBJECTS:libblisp_obj>)
add_library(libblisp_static STATIC $<TARGET_OBJECTS:libblisp_obj>)
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()

View File

@ -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 ()
endif ()
install(TARGETS blisp DESTINATION bin)