CMake: Fix sanitizer builds

The sanitizer flags need to be applied to all compilation units, and to all final link stages.

As this is whole-project (dawn + tint), these options have been promoted to DAWN_ options.

Bug: dawn:1339
Change-Id: I17beb5bd2a8f15de9d8f13d132356b5c663d71bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86143
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-04-08 18:08:36 +00:00
committed by Dawn LUCI CQ
parent d820f48f35
commit 96e245e576
12 changed files with 52 additions and 27 deletions

View File

@@ -131,9 +131,9 @@ if [ "$BUILD_SYSTEM" == "cmake" ]; then
fi
if [ "$BUILD_SANITIZER" == "asan" ]; then
COMMON_CMAKE_FLAGS+=" -DTINT_ENABLE_ASAN=1"
COMMON_CMAKE_FLAGS+=" -DDAWN_ENABLE_ASAN=1"
elif [ "$BUILD_SANITIZER" == "ubsan" ]; then
COMMON_CMAKE_FLAGS+=" -DTINT_ENABLE_UBSAN=1"
COMMON_CMAKE_FLAGS+=" -DDAWN_ENABLE_UBSAN=1"
export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
fi