-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinstallRules.cmake
92 lines (80 loc) · 2.5 KB
/
installRules.cmake
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
89
90
91
92
if(PROJECT_IS_TOP_LEVEL)
set(CMAKE_INSTALL_INCLUDEDIR
"include/shared-${PROJECT_VERSION}"
CACHE PATH ""
)
endif()
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
# find_package(<package>) call for consumers to find this project
set(package metacg)
# We put the export file there. We currently don't really use the export file (and I'm unsure if we should)
install(
DIRECTORY include/ "${PROJECT_BINARY_DIR}/graph/export/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/metacg"
COMPONENT metacg_Development
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
)
# Installation rule for the metacg library. Honestly, not sure what all this does. Following the example here:
# https://github.com/friendlyanon/cmake-init-shared-static/blob/master/cmake/install-rules.cmake
install(
TARGETS metacg
EXPORT metacgTargets
RUNTIME #
COMPONENT metacg_Runtime
LIBRARY #
COMPONENT metacg_Runtime NAMELINK_COMPONENT metacg_Development
ARCHIVE #
COMPONENT metacg_Development
INCLUDES #
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
# Call helper function to "generate" a metacgConfigVersion file
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
VERSION ${PACKAGE_VERSION}
COMPATIBILITY SameMajorVersion
)
# Allow package maintainers to freely override the path for the configs
set(metacg_INSTALL_CMAKEDIR
"${CMAKE_INSTALL_LIBDIR}/cmake/${package}"
CACHE PATH "CMake package config location relative to the install prefix"
)
mark_as_advanced(metacg_INSTALL_CMAKEDIR)
# Install the install-config file as metacgConfig.cmake file
install(
FILES ../cmake/install-config.cmake
DESTINATION "${metacg_INSTALL_CMAKEDIR}"
RENAME "${package}Config.cmake"
COMPONENT metacg_Development
)
# Install the package config version file
install(
FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
DESTINATION "${metacg_INSTALL_CMAKEDIR}"
COMPONENT metacg_Development
)
# Install config.h
install(
FILES "${PROJECT_BINARY_DIR}/config.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/metacg"
COMPONENT metacg_Development
)
# Install the MetaCG graph library
install(
EXPORT metacgTargets
NAMESPACE metacg::
DESTINATION "${metacg_INSTALL_CMAKEDIR}"
COMPONENT metacg_Development
)
# Install the generated CustomMD.h header
install(
FILES ${PROJECT_BINARY_DIR}/graph/include/metadata/CustomMD.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/metacg/metadata
COMPONENT metacg_Development
)
if(PROJECT_IS_TOP_LEVEL)
include(CPack)
endif()