forked from jeremy-rifkin/cpptrace
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstallRules.cmake
More file actions
88 lines (78 loc) · 2.54 KB
/
Copy pathInstallRules.cmake
File metadata and controls
88 lines (78 loc) · 2.54 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
include(CMakePackageConfigHelpers)
# copy header files to CMAKE_INSTALL_INCLUDEDIR
# don't include third party header files
install(
DIRECTORY
"${PROJECT_SOURCE_DIR}/include/" # our header files
"${PROJECT_BINARY_DIR}/include/" # generated header files
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT ${package_name}_development
# PATTERN "**/third_party" EXCLUDE # skip third party directory
# PATTERN "**/third_party/**" EXCLUDE # skip third party files
)
# copy target build output artifacts to OS dependent locations
# (Except includes, that just sets a compiler flag with the path)
install(
TARGETS ${target_name}
EXPORT ${package_name}-targets
RUNTIME #
COMPONENT ${package_name}_runtime
LIBRARY #
COMPONENT ${package_name}_runtime
NAMELINK_COMPONENT ${package_name}_development
ARCHIVE #
COMPONENT ${package_name}_development
INCLUDES #
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILE_SET CXX_MODULES
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/cpptrace"
)
# create config file that points to targets file
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/in/cpptrace-config-cmake.in"
"${PROJECT_BINARY_DIR}/cmake/${package_name}-config.cmake"
@ONLY
)
# copy config file for find_package to find
install(
FILES "${PROJECT_BINARY_DIR}/cmake/${package_name}-config.cmake"
DESTINATION "${CPPTRACE_INSTALL_CMAKEDIR}"
COMPONENT ${package_name}_development
)
# create version file for consumer to check version in CMake
write_basic_package_version_file(
"${package_name}-config-version.cmake"
COMPATIBILITY SameMajorVersion # a.k.a SemVer
)
# copy version file for find_package to find for version check
install(
FILES "${PROJECT_BINARY_DIR}/${package_name}-config-version.cmake"
DESTINATION "${CPPTRACE_INSTALL_CMAKEDIR}"
COMPONENT ${package_name}_development
)
# create targets file included by config file with targets for consumers
install(
EXPORT ${package_name}-targets
NAMESPACE cpptrace::
DESTINATION "${CPPTRACE_INSTALL_CMAKEDIR}"
COMPONENT ${package_name}_development
)
if(CPPTRACE_PROVIDE_EXPORT_SET)
export(
TARGETS ${target_name}
NAMESPACE cpptrace::
FILE "${PROJECT_BINARY_DIR}/${package_name}-targets.cmake"
)
endif()
# Findzstd.cmake
# vcpkg doesn't like anything being put in share/, which is where this goes apparently on their setup
if(NOT CPPTRACE_VCPKG)
install(
FILES "${PROJECT_SOURCE_DIR}/cmake/Findzstd.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${package_name}"
)
endif()
# support packaging library
if(PROJECT_IS_TOP_LEVEL)
include(CPack)
endif()