diff --git a/mm/kasan/CMakeLists.txt b/mm/kasan/CMakeLists.txt index 47fe790d7891d..bba4df4f52bf6 100644 --- a/mm/kasan/CMakeLists.txt +++ b/mm/kasan/CMakeLists.txt @@ -19,7 +19,11 @@ # ############################################################################## if(CONFIG_MM_KASAN) target_sources(mm PRIVATE kasan.c) - set_source_files_properties(kasan.c PROPERTIES COMPILE_FLAGS - -fno-sanitize=kernel-address) - set_source_files_properties(kasan.c PROPERTIES COMPILE_FLAGS -fno-lto) + + target_compile_options(mm PRIVATE -fno-sanitize=kernel-address) + + if(NOT CONFIG_LTO_NONE) + target_compile_options(mm PRIVATE -fno-lto) + endif() + endif()