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.
This commit is contained in:
Andreas Kling 2021-02-23 16:30:30 +01:00
parent 31ac93d051
commit de52fe6156
Notes: sideshowbarker 2024-07-18 21:59:23 +09:00

View file

@ -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")