[cmake-developers] Disabling leaks check when using Address Sanitizer

Sylvain Joubert joubert.sy at gmail.com
Fri Dec 16 04:35:03 EST 2016


Hi everyone,

I've setup some sanitizer builds on my project and I'd like to have two
separate builds for asan and lsan, meaning I want to disable leak detection
in the asan build.
I've managed to correctly setup the CTEST_MEMORYCHECK_SANITIZER_OPTIONS
with "detect_leaks=0" and at runtime (ctest_memcheck) the ASAN_OPTIONS is
populated with my custom value.

The issue is that CMake appends its own "detect_leak=1" (while
"log_file=..." is prepended). It overrides my own option which has then no
effect.

I see two possible fixes here:
1- Since "detect_leaks=1" is the default, we can simply not append it to
the options and make sure the user options are last
2- If we still want to explicitly set "detect_leaks=1", I'd suggest to
prepend it, like "log_file=", to the user options so that anyone can
override them if need be

The related code seems to be at:
25d7b883 : Source/CTest/cmCTestMemCheckHandler.cxx:600

If my analysis is correct I can make a MR. Which fixes would you prefer?

Regards,
Sylvain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20161216/37ae3ad6/attachment.html>


More information about the cmake-developers mailing list