To use any sanitizer(s), add it to the ENABLE_SANITIZERS list on
the CMake command line.
cmake -GNinja .. -DENABLE_SANITIZERS=undefined cmake -GNinja .. -DENABLE_SANITIZERS=address;leak
This requires an additional dependency to work:
ECM (Extra Cmake Modules, https://api.kde.org/ecm/index.html)
To install on Debian/Ubuntu:
sudo apt install extra-cmake-modules
This dependency is only required if the ENABLE_SANITIZERS variable
is set, it is not necessary to do a standard build.
The ECM package will check for compiler compatibility and set the
appropriated options for each sanitizer. It will eventually remove the
optimization options that may conflict with the selected sanitizers.