Skip to content

Commit 61da1e2

Browse files
leamasmoriarty
authored andcommitted
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 <[email protected]> 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 <[email protected]>
1 parent c9da89d commit 61da1e2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CMakeLists.txt

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required(VERSION 3.5.0)
22

33
# General setup
4+
set(PROJ_SOVERSION 1)
45
project(serial
56
VERSION 1.2.1
67
DESCRIPTION "Cross-platform, Serial Port library written in C++"
@@ -33,9 +34,18 @@ else()
3334
endif()
3435

3536
## Add serial library
37+
set(serial_HEADERS
38+
include/serial/serial.h
39+
include/serial/v8stdint.h
40+
)
41+
# Build, link and install main library
3642
add_library(${PROJECT_NAME} ${serial_SRCS})
3743
set_target_properties(${PROJECT_NAME} PROPERTIES
38-
POSITION_INDEPENDENT_CODE ON)
44+
VERSION ${PROJECT_VERSION}
45+
SOVERSION ${PROJ_SOVERSION}
46+
PUBLIC_HEADER "${serial_HEADERS}"
47+
)
48+
target_include_directories(${PROJECT_NAME} PUBLIC include)
3949

4050
if(APPLE)
4151
target_link_libraries(${PROJECT_NAME} ${FOUNDATION_LIBRARY} ${IOKIT_LIBRARY})
@@ -58,6 +68,7 @@ install(TARGETS ${PROJECT_NAME}
5868
ARCHIVE DESTINATION lib
5969
LIBRARY DESTINATION lib
6070
RUNTIME DESTINATION bin
71+
PUBLIC_HEADER DESTINATION include/${PROJECT_NAME}
6172
)
6273

6374
## Install headers

0 commit comments

Comments
 (0)