Commit f5275b5
committed
cmake: Add TCMALLOC_ENABLE_INSTALL with export/config infrastructure
Add a complete install and export system, mirroring abseil-cpp's
ABSL_ENABLE_INSTALL mechanism. Key changes:
- Add option(TCMALLOC_ENABLE_INSTALL): defaults to OFF when used as a
subproject, ON when standalone (exactly matching Abseil's behavior)
- Remove the hard-coded CMAKE_SKIP_INSTALL_RULES=ON
- Create CMake/tcmallocConfig.cmake.in template (analogous to
CMake/abslConfig.cmake.in) that finds Threads and absl dependencies
then includes the exported targets file
- Add install(EXPORT tcmallocTargets) with tcmalloc:: namespace
- Add configure_package_config_file() to generate tcmallocConfig.cmake
- Add install(DIRECTORY tcmalloc ...) for public headers, excluding
test-only headers (testing/, mock_*)
After this change, downstream projects can use:
find_package(tcmalloc REQUIRED)
target_link_libraries(myapp PRIVATE tcmalloc::tcmalloc)
The install rules in tcmalloc_cc_library() (added in the previous
commit) are automatically activated when TCMALLOC_ENABLE_INSTALL is ON.1 parent d74057b commit f5275b5
2 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
| |||
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
0 commit comments