-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
83 lines (70 loc) · 1.96 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
cmake_minimum_required(VERSION 3.22 FATAL_ERROR)
project(mropes
VERSION 1.0.1.0
LANGUAGES C
)
set(mropes_SOURCES
src/rope.c
src/rope_ops.c
src/rope_stack.c
src/version.h.in
)
set(mropes_INCLUDES
include/mropes/rope.h
)
set(mropes_HEADERS
src/rope_ops.h
src/rope_stack.h
)
configure_file(src/version.h.in include/mropes/version.h)
add_library(${PROJECT_NAME} SHARED
${mropes_SOURCES}
${mropes_INCLUDES}
${mropes_HEADERS}
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
set_target_properties(${PROJECT_NAME}
PROPERTIES
C_STANDARD 99
C_STANDARD_REQUIRED ON
C_EXTENSIONS OFF
SOVERSION 1
PUBLIC_HEADER ${mropes_INCLUDES}
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib/${PROJECT_NAME}
PUBLIC_HEADER DESTINATION include/${PROJECT_NAME}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/include/mropes/version.h
DESTINATION include/${PROJECT_NAME}
)
install(
EXPORT ${PROJECT_NAME}
DESTINATION lib/cmake/${PROJECT_NAME}
)
#Setup CPACK to generate installer
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_GENERATOR "DEB;TGZ;ZIP")
set(CPACK_DEBIAN_PACKAGE_NAME "mropes")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Rui Maciel")
include(CPack)
option(ENABLE_TESTS "Enable tests" ON)
if (${ENABLE_TESTS})
enable_testing()
add_subdirectory(tests)
endif()