@@ -12,14 +12,20 @@ project(
1212# [CMAKE.SKIP_TESTS]
1313option (
1414 BEMAN_ANY_VIEW_BUILD_TESTS
15- "Enable building tests and test infrastructure. Default: ON . Values: { ON, OFF }."
15+ "Enable building tests and test infrastructure. Default: ${PROJECT_IS_TOP_LEVEL} . Values: { ON, OFF }."
1616 ${PROJECT_IS_TOP_LEVEL}
1717)
1818
1919# [CMAKE.SKIP_EXAMPLES]
2020option (
2121 BEMAN_ANY_VIEW_BUILD_EXAMPLES
22- "Enable building examples. Default: ON. Values: {ON, OFF}."
22+ "Enable building examples. Default: ${PROJECT_IS_TOP_LEVEL} . Values: {ON, OFF}."
23+ ${PROJECT_IS_TOP_LEVEL}
24+ )
25+
26+ option (
27+ BEMAN_ANY_VIEW_INSTALL_CONFIG_FILE_PACKAGE
28+ "Enable creating and installing a CMake config-file package. Default: ${PROJECT_IS_TOP_LEVEL} . Values: { ON, OFF }."
2329 ${PROJECT_IS_TOP_LEVEL}
2430)
2531
@@ -44,37 +50,49 @@ configure_file(
4450 @ONLY
4551)
4652
47- set (CMAKE_CXX_EXTENSIONS OFF )
48-
49- include (FetchContent)
50- include (GNUInstallDirs)
51-
5253# [CMAKE.LIBRARY_NAME]
5354add_library (beman.any_view INTERFACE )
5455# [CMAKE.LIBRARY_ALIAS]
5556add_library (beman::any_view ALIAS beman.any_view)
56- target_include_directories (
57+
58+ set_target_properties (
5759 beman.any_view
58- INTERFACE
59- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >
60- $<BUILD_INTERFACE:${PROJECT_BINARY_DIR} /include >
61- $<INSTALL_INTERFACE:include >
60+ PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON EXPORT_NAME any_view
6261)
6362
64- install (
65- TARGETS beman.any_view
66- EXPORT ${TARGETS_EXPORT_NAME}
67- DESTINATION
68- $<$<CONFIG:Debug>:debug/>${CMAKE_INSTALL_LIBDIR}
63+ target_sources (
64+ beman.any_view
65+ PUBLIC
66+ FILE_SET HEADERS
67+ BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR} /include include
68+ FILES
69+ ${CMAKE_CURRENT_BINARY_DIR} /include /beman/any_view/config.hpp
70+ include /beman/any_view/detail/any_iterator.hpp
71+ include /beman/any_view/detail/concepts.hpp
72+ include /beman/any_view/detail/intrusive_small_ptr.hpp
73+ include /beman/any_view/detail/iterator_adaptor.hpp
74+ include /beman/any_view/detail/iterator_interface.hpp
75+ include /beman/any_view/detail/type_traits.hpp
76+ include /beman/any_view/detail/utility.hpp
77+ include /beman/any_view/detail/view_adaptor.hpp
78+ include /beman/any_view/detail/view_interface.hpp
79+ include /beman/any_view/any_view_options.hpp
80+ include /beman/any_view/any_view.hpp
81+ include /beman/any_view/concepts.hpp
6982)
7083
71- install (
72- DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} /
73- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} /${CMAKE_PROJECT_NAME}
74- FILES_MATCHING
75- PATTERN "${CMAKE_CURRENT_SOURCE_DIR} /include/beman/any_view/*.hpp"
76- PATTERN "${CMAKE_CURRENT_BINARY_DIR} /include/beman/any_view/*.hpp"
77- )
84+ include (GNUInstallDirs)
85+
86+ install (TARGETS beman.any_view EXPORT beman.any_view-targets FILE_SET HEADERS)
87+
88+ if (BEMAN_ANY_VIEW_INSTALL_CONFIG_FILE_PACKAGE)
89+ install (
90+ EXPORT beman.any_view-targets
91+ FILE beman.any_view-config.cmake
92+ DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/beman.any_view"
93+ NAMESPACE beman::
94+ )
95+ endif ()
7896
7997function (beman_add_executable)
8098 set (options )
0 commit comments