-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
60 lines (49 loc) · 1.58 KB
/
CMakeLists.txt
File metadata and controls
60 lines (49 loc) · 1.58 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
# -------------------------------------------------------------------------- #
# cppreg library CMake script
#
# Nicolas Clauvelin ([email protected])
# Sendyne Corp., 2022
#
# -------------------------------------------------------------------------- #
# --- cppreg library ---
# Header directories.
set(cppreg_headers_dirs
.
policies/
register/)
# List of API headers.
set(cppreg_headers
cppreg.h
cppreg_Defines.h
cppreg_Includes.h
policies/AccessPolicy.h
register/Field.h
register/Internals.h
register/Mask.h
register/Memory.h
register/MergeWrite.h
register/Register.h
register/RegisterPack.h
register/ShadowValue.h
register/Traits.h)
# Refactor headers directories.
set(build_cppreg_headers_dirs "")
foreach(dir IN ITEMS ${cppreg_headers_dirs})
list(APPEND build_cppreg_headers_dirs "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
endforeach()
# Header-only library.
add_library(cppreg INTERFACE)
target_include_directories(cppreg INTERFACE ${cppreg_headers_dirs})
# Include directories interfaces.
# This properly setup the API headers for the build and install phase.
set_property(TARGET cppreg
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${build_cppreg_headers_dirs}>
$<INSTALL_INTERFACE:include/cppreg>)
# --- Install directives ---
set(include_dest "include/cppreg")
install(FILES ${cppreg_headers} DESTINATION ${include_dest})
install(TARGETS cppreg DESTINATION lib EXPORT cppreg-cmake)
install(EXPORT cppreg-cmake
DESTINATION ${include_dest}
NAMESPACE cppreg::)