Skip to content

Commit c8575f4

Browse files
authored
Enable sanitizers support on gcc compiler (#233)
1 parent dda76cf commit c8575f4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmake/sanitizers.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
option(ENABLE_ADDRESS_SANITIZER OFF)
2-
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
33
if (ENABLE_ADDRESS_SANITIZER)
44
add_compile_options(-fsanitize=address)
55
add_link_options(-fsanitize=address)
6-
message(STATUS "Enabled clang address sanitizer")
6+
message(STATUS "Enabled address sanitizer")
77
endif()
88
if (ENABLE_UB_SANITIZER)
99
add_compile_options(-fsanitize=undefined)
1010
add_link_options(-fsanitize=undefined)
11-
message(STATUS "Enabled clang UB sanitizer")
11+
message(STATUS "Enabled UB sanitizer")
1212
endif()
1313
else()
14-
message(WARNING "Sanitizers are supported on clang compiler only! Switch your compiler to clang to enable it")
14+
message(WARNING "Sanitizers are supported on gcc and clang compilers only!")
1515
endif()

0 commit comments

Comments
 (0)