|
1 | 1 | cmake_minimum_required(VERSION 3.20) |
2 | | -project(stlab-copy-on-write) |
| 2 | +project(stlab-copy-on-write |
| 3 | + VERSION 1.0.2 |
| 4 | + DESCRIPTION "Copy-on-write wrapper for any type" |
| 5 | +) |
3 | 6 |
|
4 | 7 | # Enable testing for this project |
5 | 8 | include(CTest) |
@@ -65,6 +68,42 @@ target_include_directories(stlab-copy-on-write |
65 | 68 | $<INSTALL_INTERFACE:include> |
66 | 69 | ) |
67 | 70 |
|
| 71 | +# Generate and install CMake config files |
| 72 | +include(CMakePackageConfigHelpers) |
| 73 | +write_basic_package_version_file( |
| 74 | + "${CMAKE_CURRENT_BINARY_DIR}/stlab-copy-on-write-config-version.cmake" |
| 75 | + VERSION ${PROJECT_VERSION} |
| 76 | + COMPATIBILITY SameMajorVersion |
| 77 | +) |
| 78 | + |
| 79 | +configure_package_config_file( |
| 80 | + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/stlab-copy-on-write-config.cmake.in" |
| 81 | + "${CMAKE_CURRENT_BINARY_DIR}/stlab-copy-on-write-config.cmake" |
| 82 | + INSTALL_DESTINATION lib/cmake/stlab-copy-on-write |
| 83 | +) |
| 84 | + |
| 85 | +# Installation rules |
| 86 | +install(TARGETS stlab-copy-on-write |
| 87 | + EXPORT stlab-copy-on-write-targets |
| 88 | + INCLUDES DESTINATION include |
| 89 | +) |
| 90 | + |
| 91 | +install(DIRECTORY include/ |
| 92 | + DESTINATION include |
| 93 | +) |
| 94 | + |
| 95 | +install(EXPORT stlab-copy-on-write-targets |
| 96 | + FILE stlab-copy-on-write-targets.cmake |
| 97 | + NAMESPACE stlab:: |
| 98 | + DESTINATION lib/cmake/stlab-copy-on-write |
| 99 | +) |
| 100 | + |
| 101 | +install(FILES |
| 102 | + "${CMAKE_CURRENT_BINARY_DIR}/stlab-copy-on-write-config.cmake" |
| 103 | + "${CMAKE_CURRENT_BINARY_DIR}/stlab-copy-on-write-config-version.cmake" |
| 104 | + DESTINATION lib/cmake/stlab-copy-on-write |
| 105 | +) |
| 106 | + |
68 | 107 | # Function to add a test executable with all necessary setup |
69 | 108 | function(add_test_executable NAME) |
70 | 109 | add_executable(${NAME} test/${NAME}.cpp) |
@@ -111,7 +150,7 @@ if(BUILD_DOCS) |
111 | 150 | # Set variables for Doxyfile template |
112 | 151 | set(PROJECT_NAME "stlab::copy_on_write") |
113 | 152 | set(PROJECT_BRIEF "Copy-on-write wrapper for any type") |
114 | | - set(PROJECT_VERSION "1.0.0") |
| 153 | + set(PROJECT_VERSION "${PROJECT_VERSION}") |
115 | 154 | set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
116 | 155 | set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") |
117 | 156 | set(AWESOME_CSS_PATH "${AWESOME_CSS_DIR}") |
|
0 commit comments