-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
62 lines (48 loc) · 1.89 KB
/
CMakeLists.txt
File metadata and controls
62 lines (48 loc) · 1.89 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
cmake_minimum_required(VERSION 3.16)
project(panicdump VERSION 1.0.0 LANGUAGES C ASM)
# ---------------------------------------------------------------------------
# Options
# ---------------------------------------------------------------------------
option(PANICDUMP_HALT_ON_FAULT "Halt (BKPT) instead of reset after dump" OFF)
option(PANICDUMP_BUILD_EXAMPLES "Build example projects" OFF)
option(PANICDUMP_BUILD_TESTS "Build host unit tests" OFF)
# ---------------------------------------------------------------------------
# Library target
# ---------------------------------------------------------------------------
add_library(panicdump STATIC
src/panicdump.c
src/panicdump_port_cortexm.c
ports/cortexm/panicdump_fault_entry.S
)
target_include_directories(panicdump PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if(PANICDUMP_HALT_ON_FAULT)
target_compile_definitions(panicdump PUBLIC PANICDUMP_HALT_ON_FAULT)
endif()
# Cortex-M specific flags (set by toolchain file or parent project)
# Expected: -mcpu=cortex-m4 -mthumb etc.
# ---------------------------------------------------------------------------
# Examples
# ---------------------------------------------------------------------------
if(PANICDUMP_BUILD_EXAMPLES)
add_subdirectory(examples/stm32f4_demo)
add_subdirectory(examples/generic_cortexm_demo)
endif()
# ---------------------------------------------------------------------------
# Installation
# ---------------------------------------------------------------------------
include(GNUInstallDirs)
install(TARGETS panicdump
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(FILES
docs/FORMAT.md
docs/LIMITATIONS.md
DESTINATION ${CMAKE_INSTALL_DOCDIR}
)