Make sanitizer options more fine-grained
authorStephan Beyer <s-beyer@gmx.net>
Fri, 15 May 2020 23:52:29 +0000 (01:52 +0200)
committerStephan Beyer <s-beyer@gmx.net>
Tue, 19 May 2020 08:57:02 +0000 (10:57 +0200)
commit00574ef8b482787d060ca5dfd254e86b7ea85e3c
treecaffb77555901cb55bb9464bf640376262c68b1c
parentb7517e9082500aa11a8888490a7c28aa94cc429c
Make sanitizer options more fine-grained

The SANITIZE_ADDRESS option of our CMake configuration activates the
AddressSanitizer (and UBSan in a non-working way) for the whole project
(although, by the way, its documentation pretends that it is only enabled
for tests).

This commit introduces new options SANITIZE_LEAK, SANITIZE_MEMORY,
SANITIZE_UNDEFINED, SANITIZE_THREAD.  Each of these options (including
SANITIZE_ADDRESS) enables only the corresponding sanitizer.

Moreover, we mark all sanitizer options as advanced options, because these
options are only interesting for developers.

Note that some sanitizers are conflicting, that is, not all options can
be enabled simultaneously.  Also, not all sanitizers are available for
all compilers and versions.  We, however, do not check for this, instead
we let the compiler throw its errors in such cases.

The explicit usage of the Google Linker is removed, because it is not
necessary and can lead to problems with clang.

The commit can be considered a rewrite of cmake/modules/SanitizerFlags.cmake.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
CMakeLists.txt
cmake/modules/SanitizerFlags.cmake