Commit c3a3dda
committed
cmake: Use generator expression include directories
Replace raw ${CMAKE_SOURCE_DIR} include directory references with
proper CMake generator expressions using BUILD_INTERFACE and
INSTALL_INTERFACE, mirroring abseil-cpp's ABSL_COMMON_INCLUDE_DIRS
pattern:
- Define TCMALLOC_COMMON_INCLUDE_DIRS at module scope
- In tcmalloc_cc_library(): use $<BUILD_INTERFACE:...> for build tree
and $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> for installs
- In tcmalloc_cc_test(): use $<BUILD_INTERFACE:...> (tests are never
installed so no INSTALL_INTERFACE needed)
This fixes correctness when tcmalloc is used as a subdirectory of
another project (where CMAKE_SOURCE_DIR points to the parent) and
enables proper include paths in installed config files.1 parent fcd9b33 commit c3a3dda
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
37 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
52 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
53 | 66 | | |
54 | 67 | | |
55 | 68 | | |
| |||
78 | 91 | | |
79 | 92 | | |
80 | 93 | | |
81 | | - | |
| 94 | + | |
| 95 | + | |
82 | 96 | | |
83 | 97 | | |
84 | 98 | | |
| |||
0 commit comments