Commit 4a97117
committed
cmake: Gate test-only libraries behind TESTONLY flag
Add TESTONLY to 16 tcmalloc_cc_library() calls that correspond to
testonly targets in the Bazel BUILD files but were being built
unconditionally in CMake. This ensures that when TCMALLOC_BUILD_TESTING
is OFF, no test-only source code is compiled.
Libraries marked TESTONLY:
tcmalloc/CMakeLists.txt (7):
- tcmalloc_tcmalloc_internal_methods_only
- tcmalloc_mock_central_freelist
- tcmalloc_mock_static_forwarder
- tcmalloc_mock_virtual_allocator
- tcmalloc_page_allocator_test_util
- tcmalloc_mock_transfer_cache
- tcmalloc_mock_huge_page_static_forwarder
tcmalloc/internal/CMakeLists.txt (3):
- tcmalloc_internal_affinity
- tcmalloc_internal_mock_metadata_allocator
- tcmalloc_internal_mock_span
tcmalloc/testing/CMakeLists.txt (6):
- tcmalloc_testing_malloc_hook_recorder
- tcmalloc_testing_testutil
- tcmalloc_testing_thread_manager
- tcmalloc_testing_thread_ctor_test_lib
- tcmalloc_testing_benchmark_main
- tcmalloc_testing_test_allocator_harness
Also fixes the top-level CMakeLists.txt:
- Move ABSL_BUILD_TEST_HELPERS, ABSL_USE_EXTERNAL_GOOGLETEST, and
ABSL_FIND_GOOGLETEST behind the testing guard so abseil does not
attempt to fetch googletest when tests are disabled.
- Move protobuf out of the test-only dependency block since
profile_builder and profile_marshaler are core (non-testonly)
libraries that require it.1 parent 4bca48b commit 4a97117
4 files changed
Lines changed: 46 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
97 | 124 | | |
98 | 125 | | |
99 | 126 | | |
| |||
127 | 154 | | |
128 | 155 | | |
129 | 156 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
722 | 723 | | |
723 | 724 | | |
724 | 725 | | |
| 726 | + | |
725 | 727 | | |
726 | 728 | | |
727 | 729 | | |
| |||
740 | 742 | | |
741 | 743 | | |
742 | 744 | | |
| 745 | + | |
743 | 746 | | |
744 | 747 | | |
745 | 748 | | |
| |||
756 | 759 | | |
757 | 760 | | |
758 | 761 | | |
| 762 | + | |
759 | 763 | | |
760 | 764 | | |
761 | 765 | | |
| |||
771 | 775 | | |
772 | 776 | | |
773 | 777 | | |
| 778 | + | |
774 | 779 | | |
775 | 780 | | |
776 | 781 | | |
| |||
788 | 793 | | |
789 | 794 | | |
790 | 795 | | |
| 796 | + | |
791 | 797 | | |
792 | 798 | | |
793 | 799 | | |
| |||
809 | 815 | | |
810 | 816 | | |
811 | 817 | | |
| 818 | + | |
812 | 819 | | |
813 | 820 | | |
814 | 821 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
| 501 | + | |
500 | 502 | | |
501 | 503 | | |
502 | 504 | | |
| |||
573 | 575 | | |
574 | 576 | | |
575 | 577 | | |
| 578 | + | |
576 | 579 | | |
577 | 580 | | |
578 | 581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
| 236 | + | |
234 | 237 | | |
235 | 238 | | |
236 | 239 | | |
| |||
353 | 356 | | |
354 | 357 | | |
355 | 358 | | |
| 359 | + | |
356 | 360 | | |
357 | 361 | | |
358 | 362 | | |
| |||
610 | 614 | | |
611 | 615 | | |
612 | 616 | | |
| 617 | + | |
613 | 618 | | |
614 | 619 | | |
615 | 620 | | |
| |||
650 | 655 | | |
651 | 656 | | |
652 | 657 | | |
| 658 | + | |
653 | 659 | | |
654 | 660 | | |
655 | 661 | | |
| |||
0 commit comments