-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (42 loc) · 1.36 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
# Specify the minimum version.
cmake_minimum_required(VERSION 3.9)
# Specify the project info.
project(data_structures VERSION 1.0.0 DESCRIPTION "Data structures in C")
# Declare the library target.
add_library(${PROJECT_NAME} SHARED
src/data_structures.h
src/deque.h
src/deque.c
src/trie.h
src/trie.c
src/singly_linked_list.h
src/singly_linked_list.c
src/vector.h
src/vector.c
)
# Configure the directories to search for header files.
target_include_directories(${PROJECT_NAME} PRIVATE src)
# Set the public header property to the one with the actual API.
set(ALL_PUBLIC_HEADERS
"src/data_structures.h"
"src/deque.h"
"src/trie.h"
"src/singly_linked_list.h"
"src/vector.h"
)
set_target_properties(${PROJECT_NAME} PROPERTIES
PUBLIC_HEADER "${ALL_PUBLIC_HEADERS}"
)
# For access to standard installation directory variables (CMAKE_INSTALL_xDIR).
include(GNUInstallDirs)
# Set library shared object and API header file to install.
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Create the pkg-config file from the template.
configure_file(src/${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
# Set pkg-config file to install.
install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)