When installing the library, each build type (-DCMAKE_BUILD_TYPE=XXX) allows a separate configuration.
The configuration doesn't affect your targets, you can link to any configuration (your compiler might complain though, if you link your debug target to a library compiled in release mode or vice-versa).
The build types Debug, RelWithDebInfo and Release provide pre-defined values for the debugging options,
those cannot be overridden.
You can create as many build types as you want.
There are the following variables available to configure it:
-
FOONATHAN_MEMORY_BUILD_EXAMPLES/_TESTS: whether or not to build examples or tests. If this isOFFtheir CMake scripts are not even included. It isONfor standalone builds andOFFif used inadd_subdirectory(). -
FOONATHAN_MEMORY_BUILD_TOOLS: whether or not build the tools. Unlike the other two options, this is alwaysON. -
FOONATHAN_MEMORY_EXTERN_TEMPLATE: If active the library provides already the definition of common instantiations of its class templates. This can speed up compilation time of user code since the compiler does not need to generate the definition each time the class instantiation is used (this compilation time is done when compiling the library and the size of the library binary increases). Default isON. -
FOONATHAN_MEMORY_DEFAULT_ALLOCATOR: The default allocator used by the higher level allocator classes. One of the low level allocators (see \ref foonathan::memory::default_allocator). Default isheap_allocator. -
FOONATHAN_MEMORY_TEMPORARY_STACK_MODE: Thetemporary_allocatoruses atemporary_stackfor its allocation. This option controls how and if a global, per-thread instance of it is managed. If2it is automatically managed and created on-demand, if1you need explicit lifetime control through thetemporary_stack_initializerclass and if0there is no stack created automatically. Mode2has a slight runtime overhead. -
FOONATHAN_MEMORY_DEBUG_*: Specifies debugging options such as pointer check indeallocate()or filling newly allocated memory with values. They are set automatically for certain build types and cannot be overriden: All of them are enabled inDebugbuilds, the faster ones inRelWithDebInfoand none inRelease. See debugging for a detailed description.
A list of all options with description is generated by calling cmake -LH.
The following variables or targets are available if used with add_subdirectory():
FOONATHAN_MEMORY_INCLUDE_DIR(variable): The include directory for the header files.FOONATHAN_MEMORY_VERSION[_MAJOR/MINOR](variable): Major and minor version of the library.foonathan_memory(target): The target of the library you can link to.foonathan_memory_example_*(target): The targets for the examples. Only available ifFOONATHAN_MEMORY_BUILD_EXAMPLESisON.foonathan_memory_test(target): The test target. Only available ifFOONATHAN_MEMORY_BUILD_TESTSisON.foonathan_memory_profiling(target): The profiling target. Only available ifFOONATHAN_MEMORY_BUILD_TESTSisON.foonathan_memory_node_size_debugger(target): The target that generates the container node size information. Only available ifFOONATHAN_MEMORY_BUILD_TOOLSisON.
Also every function from foonathan/compatibility is exposed.