-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
88 lines (66 loc) · 3.1 KB
/
Copy pathCMakeLists.txt
File metadata and controls
88 lines (66 loc) · 3.1 KB
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.17)
set(CMAKE_CXX_STANDARD 17)
project(feeling-blue
VERSION 1.02
DESCRIPTION "mylib description")
include(GNUInstallDirs)
set(SOURCE_FILES macOS/src/main.cpp)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# --------------------------------------------------------------------------------
# Build options
# --------------------------------------------------------------------------------
option(BUILD_DOCUMENTATION "Create the API documentation" OFF)
option(BUILD_TESTS "Build the tests" OFF)
option(VERBOSE_MODE "NSLog what your bluetooth device is doing" ON)
# --------------------------------------------------------------------------------
# Include directories
# --------------------------------------------------------------------------------
include_directories(${PROJECT_SOURCE_DIR}/include)
# --------------------------------------------------------------------------------
# Public headers API
# --------------------------------------------------------------------------------
set(macOS_PUBLIC_HEADERS
./include/feeling-blue.h
./include/central.h
./include/peripheral.h
./include/service.h
./include/characteristic.h
)
set(macOS_PRIVATE_HEADERS
./include/detail/conversions.h
)
# --------------------------------------------------------------------------------
# Subdirectories
# --------------------------------------------------------------------------------
add_subdirectory(src)
if (BUILD_TESTS)
include(CTest)
enable_testing()
message("enabled building tests")
add_subdirectory(${PROJECT_SOURCE_DIR}/external/googletest)
add_subdirectory(test)
endif()
# --------------------------------------------------------------------------------
# Add directories
# --------------------------------------------------------------------------------
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
set_target_properties(${PROJECT_NAME}
PROPERTIES
PUBLIC_HEADER "${macOS_PUBLIC_HEADERS}"
PRIVATE_HEADER "${macOS_PRIVATE_HEADERS}"
)
# --------------------------------------------------------------------------------
# Doxygen Subdirectory
# --------------------------------------------------------------------------------
add_subdirectory(docs)
# --------------------------------------------------------------------------------
# Install library
# --------------------------------------------------------------------------------
install(TARGETS ${PROJECT_NAME}
EXPORT feeling-blueConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
install(EXPORT feeling-blueConfig DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/feeling-blue/cmake)
export(TARGETS ${PROJECT_NAME} FILE feeling-blueConfig.cmake)