-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
77 lines (65 loc) · 1.21 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
cmake_minimum_required(VERSION 3.20)
project(libstrop)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(FindPkgConfig)
# libprim
pkg_check_modules(libprim REQUIRED IMPORTED_TARGET libprim)
get_target_property(
LIBPRIM_INC
PkgConfig::libprim
INTERFACE_INCLUDE_DIRECTORIES
)
add_library(
strop
SHARED
${PROJECT_SOURCE_DIR}/src/strop/strop.cc
${PROJECT_SOURCE_DIR}/src/strop/strop.h
${PROJECT_SOURCE_DIR}/src/strop/strop.tcc
)
set_target_properties(
strop
PROPERTIES
LINKER_LANGUAGE
CXX
POSITION_INDEPENDENT_CODE
ON
)
target_include_directories(
strop
PUBLIC
${PROJECT_SOURCE_DIR}/src
${LIBPRIM_INC}
)
target_link_libraries(
strop
PkgConfig::libprim
)
include(GNUInstallDirs)
install(
FILES
${PROJECT_SOURCE_DIR}/src/strop/strop.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/strop/
)
install(
FILES
${PROJECT_SOURCE_DIR}/src/strop/strop.tcc
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/strop/
)
install(
TARGETS
strop
)
configure_file(
${PROJECT_SOURCE_DIR}/libstrop.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libstrop.pc
@ONLY
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/libstrop.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig/
)