summaryrefslogtreecommitdiff
path: root/Kernel/CMakeLists.txt
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-23 16:30:30 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-23 17:41:34 +0100
commitde52fe6156e1e6f862e6ed520d6782f86ae996d6 (patch)
tree4d03ff3674bacf36bb37d1b94e00580723294fe9 /Kernel/CMakeLists.txt
parent31ac93d051be5be78419ed16da9fcae9783eb4e6 (diff)
downloadserenity-de52fe6156e1e6f862e6ed520d6782f86ae996d6.zip
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.
Diffstat (limited to 'Kernel/CMakeLists.txt')
-rw-r--r--Kernel/CMakeLists.txt8
1 files 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")