Skip to content

Commit 35f363a

Browse files
committed
Export a Config.cmake file for FindPackage
Add back FindPackage support.
1 parent b7cb332 commit 35f363a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ add_subdirectory(include/beman/optional26)
5959

6060
add_subdirectory(examples)
6161

62+
63+
include(CMakePackageConfigHelpers)
64+
65+
# This will be used to replace @PACKAGE_cmakeModulesDir@
66+
set(cmakeModulesDir cmake/beman)
67+
configure_package_config_file(
68+
cmake/Config.cmake.in BemanOptional26Config.cmake
69+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/
70+
PATH_VARS cmakeModulesDir
71+
NO_SET_AND_CHECK_MACRO
72+
NO_CHECK_REQUIRED_COMPONENTS_MACRO
73+
)
74+
75+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/BemanOptional26Config.cmake
76+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/optional26/
77+
COMPONENT beman_optional26_development
78+
)
79+
6280
# Coverage
6381
configure_file("cmake/gcovr.cfg.in" gcovr.cfg @ONLY)
6482

cmake/Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cmake/Config.cmake.in -*-makefile-*-
1+
# cmake/Config.cmake.in -*-cmake-*-
22
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

44
@PACKAGE_INIT@

0 commit comments

Comments
 (0)