From de52fe6156e1e6f862e6ed520d6782f86ae996d6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Feb 2021 16:30:30 +0100 Subject: [PATCH] Kernel: Only build with -fsanitize=* if using GCC Clangd (CLion) was choking on some of the -fsanitize options, and since we're not building the kernel with Clang anyway, let's just disable the options for non-GCC compilers for now. --- Kernel/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 18e9f123ba..84e4830979 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -297,9 +297,11 @@ set(KERNEL_FSANITIZE_FLAGS # "pointer-overflow" ) -foreach(flag IN LISTS KERNEL_FSANITIZE_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${flag}") -endforeach() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + foreach(flag IN LISTS KERNEL_FSANITIZE_FLAGS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${flag}") + endforeach() +endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE -fno-rtti -ffreestanding -fbuiltin")