1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Sat, 3 Aug 2024 02:25:34 +0900
Subject: Enable sanitizer option only for supported architecture (Closes:
#1072992)
Bug-Debian: https://bugs.debian.org/1072992
Some architectures dose not support sanitizer.
---
src/test/CMakeLists.txt | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index afff2c4..e63c2a1 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -4,6 +4,7 @@ include(CMakePrintHelpers)
enable_testing()
cmake_print_variables(CMAKE_CXX_COMPILER_ID CMAKE_CXX_COMPILER_VERSION CMAKE_SIZEOF_VOID_P CMAKE_SYSTEM_PROCESSOR SSE)
+cmake_print_variables(DEB_HOST_ARCH)
# https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i686")
@@ -53,9 +54,16 @@ else()
add_compile_options(-mstackrealign)
endif()
endif()
- add_compile_options(-fsanitize=undefined -fsanitize=address)
- add_link_options(-fsanitize=undefined -fsanitize=address)
- link_libraries(-latomic)
+ if (DEB_HOST_ARCH MATCHES "^(amd64|arm64|armel|armhf|i386|ppc64|ppc64el|riscv64|s390x|sparc64|x32)$")
+ add_compile_options(-fsanitize=undefined)
+ add_link_options(-fsanitize=undefined)
+ link_libraries(-latomic)
+ endif()
+ if (DEB_HOST_ARCH MATCHES "^(amd64|arm64|armel|armhf|i386|ppc64|ppc64el|riscv64|s390x|x32)$")
+ add_compile_options(-fsanitize=address)
+ add_link_options(-fsanitize=address)
+ link_libraries(-latomic)
+ endif()
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|