File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,6 @@ add_subdirectory(src)
8888
8989# add unit tests
9090add_subdirectory (tests)
91+
92+ # finally, generate export configs
93+ include (cmake/export.cmake)
Original file line number Diff line number Diff line change 1+ # make sure CMake won't export this package by default (valid from 3.15 onwards)
2+ cmake_minimum_required (VERSION 3.15)
3+ set (CMP0090 NEW)
4+
5+ # set up installion of exported targets (consider libzsync2 a namespace for use in CMake)
6+ install (
7+ TARGETS libzsync2
8+ DESTINATION lib
9+ EXPORT libzsync2
10+ )
11+
12+ # allow import from current build tree
13+ export (
14+ TARGETS libzsync2
15+ NAMESPACE zsync2::
16+ FILE libzsync2Targets.cmake
17+ )
18+
19+ # allow import from install tree
20+ # note that the targets must be install(... EXPORT zsync) in order for this to work (consider libzsync2 a namespace)
21+ install (
22+ EXPORT libzsync2
23+ DESTINATION lib/cmake/zsync2
24+ )
25+
26+ include (CMakePackageConfigHelpers)
27+ # generate the config file that is includes the exports
28+ configure_package_config_file(
29+ "${CMAKE_CURRENT_LIST_DIR} /zsync2Config.cmake.in"
30+ "${PROJECT_BINARY_DIR} /cmake/zsync2Config.cmake"
31+ INSTALL_DESTINATION "lib/cmake/zsync2"
32+ NO_SET_AND_CHECK_MACRO
33+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
34+ )
35+
36+ write_basic_package_version_file(
37+ "${PROJECT_BINARY_DIR} /cmake/zsync2ConfigVersion.cmake"
38+ VERSION "${VERSION} "
39+ COMPATIBILITY AnyNewerVersion
40+ )
41+
42+ install (FILES
43+ "${PROJECT_BINARY_DIR} /cmake/zsync2Config.cmake"
44+ "${PROJECT_BINARY_DIR} /cmake/zsync2ConfigVersion.cmake"
45+ DESTINATION lib/cmake/zsync2
46+ )
Original file line number Diff line number Diff line change 1+ @PACKAGE_INIT@
2+
3+ include ( "${CMAKE_CURRENT_LIST_DIR} /zsync2Targets.cmake" )
You can’t perform that action at this time.
0 commit comments