-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
68 lines (55 loc) · 1.18 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
cmake_minimum_required(VERSION 3.0.0)
project(
umgmt
VERSION 0.1.0
LANGUAGES C
)
include(GNUInstallDirs)
include(CompileOptions.cmake)
include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/deps/uthash/include
)
set(
UMGMT_SOURCES
"src/umgmt/user.c"
"src/umgmt/group.c"
"src/umgmt/db.c"
)
add_library(
${CMAKE_PROJECT_NAME}
SHARED
${UMGMT_SOURCES}
)
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
# project version
set_target_properties(
${PROJECT_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
install(
FILES ${PROJECT_SOURCE_DIR}/src/umgmt.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
FILES
${PROJECT_SOURCE_DIR}/src/umgmt/types.h
${PROJECT_SOURCE_DIR}/src/umgmt/db.h
${PROJECT_SOURCE_DIR}/src/umgmt/user.h
${PROJECT_SOURCE_DIR}/src/umgmt/group.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/umgmt
)
add_custom_target(
uninstall
COMMAND xargs rm < ${PROJECT_SOURCE_DIR}/build/install_manifest.txt
)
if(ENABLE_TESTS)
find_package(CMOCKA REQUIRED)
include(CTest)
include(test/Tests.cmake)
endif()