-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
88 lines (72 loc) · 2.81 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 3.1)
project(libudev++ VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(HEADERS
device.hpp
enumerate.hpp
monitor.hpp
udev.hpp
)
set(OVERALL_HEADER udev++.hpp)
set(SOURCES
device.cpp
enumerate.cpp
monitor.cpp
udev.cpp
)
include(GNUInstallDirs)
########################
string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${PROJECT_NAME})
set(PROJECT_NAME_DEV ${PROJECT_NAME}-dev)
set(CMAKE_INSTALL_DOCDIR_DEV ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME_DEV})
# shared library
add_library(shared SHARED ${HEADERS} ${SOURCES})
set_target_properties(shared PROPERTIES OUTPUT_NAME ${LIBRARY_NAME})
set_target_properties(shared PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(shared PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
install(TARGETS shared DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT shared)
install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT shared)
# static dev library and headers
add_library(static STATIC ${HEADERS} ${SOURCES})
set_target_properties(static PROPERTIES OUTPUT_NAME ${LIBRARY_NAME})
install(TARGETS static DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT static)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBRARY_NAME} COMPONENT static)
install(FILES ${OVERALL_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT static)
install(FILES LICENSE.md README.md DESTINATION ${CMAKE_INSTALL_DOCDIR_DEV} COMPONENT static)
########################
# package
set(CPACK_STRIP_FILES ON)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"libudev++: Udev Library for C++."
)
set(CPACK_PACKAGE_DESCRIPTION
"The libudev++ library is a C++ wrapper for libudev. It enables one to
enumerate, monitor and introspect devices on the local system."
)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER
"Dimitry Ishenko <dimitry (dot) ishenko (at) (gee) mail (dot) com>"
)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_SHARED_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_DEBIAN_SHARED_PACKAGE_DEPENDS "libudev1")
set(CPACK_DEBIAN_SHARED_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_STATIC_PACKAGE_NAME ${PROJECT_NAME_DEV})
set(CPACK_DEBIAN_STATIC_PACKAGE_DEPENDS
"${CPACK_DEBIAN_SHARED_PACKAGE_NAME} (= ${PROJECT_VERSION})"
)
# source
set(CPACK_SOURCE_GENERATOR TBZ2 ZIP)
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION})
set(CPACK_SOURCE_IGNORE_FILES /\.git.*;/build.*;\.user$;/\.vscode.*)
include(CPack)
cpack_add_component(shared DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
cpack_add_component(static DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}
-
This package contains headers and static libraries needed for development."
)