From 61da1e2c994ebf3985521d9b6b431d6171c9983b Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Tue, 22 Sep 2020 13:28:04 +0200 Subject: [PATCH] cmake: Add defined so-version and public header to lib. Adding a so-version means defining an ABI level. This level is decoupled from the ordinary version, even a major version change doesn't necessarily mean that the so-version should change (and thus have all dependencies to be rebuilt). Adding the public header to clarify the setup. Note: cherry-pick from PR #231 Conflicts: CMakeLists.txt Author: Alec Leamas Date: Tue Sep 22 13:28:04 2020 +0200 Gbp-Pq: Name 0002-cmake-Add-defined-so-version-and-public-header-to-li.patch Signed-off-by: Alex Moriarty --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e3ceb1..b205423 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.5.0) # General setup +set(PROJ_SOVERSION 1) project(serial VERSION 1.2.1 DESCRIPTION "Cross-platform, Serial Port library written in C++" @@ -33,9 +34,18 @@ else() endif() ## Add serial library +set(serial_HEADERS + include/serial/serial.h + include/serial/v8stdint.h +) +# Build, link and install main library add_library(${PROJECT_NAME} ${serial_SRCS}) set_target_properties(${PROJECT_NAME} PROPERTIES - POSITION_INDEPENDENT_CODE ON) + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJ_SOVERSION} + PUBLIC_HEADER "${serial_HEADERS}" +) +target_include_directories(${PROJECT_NAME} PUBLIC include) if(APPLE) target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY}) @@ -58,6 +68,7 @@ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} ) ## Install headers