.. spelling:: tcmalloc CMake bazel
.. index:: single: unsorted ; tcmalloc
- Official
- Hunterized
- Example
- Added by Raffael Casagrande (pr-493)
.. literalinclude:: /../examples/tcmalloc/CMakeLists.txt :language: cmake :start-after: # DOCUMENTATION_START { :end-before: # DOCUMENTATION_END }
Note
- Because tcmalloc must be linked as an object library (
alwayslink
in bazel) it is require to use at least CMake 3.21. See the corresponding note on https://cmake.org/cmake/help/latest/command/target_link_libraries.html#linking-object-libraries-via-target-objects - Because tcmalloc requires at least C++17 and because it depends on abseil, it is important to make sure that abseil is also built with C++17.
Otherwise you may get link time errors related to
std::basic_string_view
. The easiest way to achieve this is to use aCMAKE_TOOLCHAIN_FILE
that setsCMAKE_CXX_STANDARD
to17
or higher.