diff --git a/arch/posix/CMakeLists.txt b/arch/posix/CMakeLists.txt index 469e1876a08..7ce45f9ad9b 100644 --- a/arch/posix/CMakeLists.txt +++ b/arch/posix/CMakeLists.txt @@ -188,7 +188,9 @@ list(JOIN LLVM_SANITIZERS "," LLVM_SANITIZERS_ARG) if(NOT ${LLVM_SANITIZERS_ARG} STREQUAL "") set(LLVM_SANITIZERS_ARG "-fsanitize=${LLVM_SANITIZERS_ARG}") zephyr_compile_options("${LLVM_SANITIZERS_ARG}") - zephyr_link_libraries("${LLVM_SANITIZERS_ARG}") + if (CONFIG_NATIVE_APPLICATION) + zephyr_link_libraries("${LLVM_SANITIZERS_ARG}") + endif() target_link_options(native_simulator INTERFACE ${LLVM_SANITIZERS_ARG}) target_compile_options(native_simulator INTERFACE ${LLVM_SANITIZERS_ARG})