travis: try to fix ubsan for clang-old
authorMichael Wallner <mike@php.net>
Wed, 30 Sep 2020 12:19:36 +0000 (14:19 +0200)
committerMichael Wallner <mike@php.net>
Wed, 30 Sep 2020 12:19:36 +0000 (14:19 +0200)
CMake/CheckDebug.cmake

index 2c873d86959b4530840b7f27dbe6b2263104e0ff..433682998b17d171a023f94e14c95fe9c1ea45ac 100644 (file)
@@ -49,6 +49,9 @@ function(check_debug)
                 if(HAVE_ASAN)
                     add_compile_definitions(HAVE_ASAN)
                     add_compile_options(-fsanitize=address)
+                    if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+                        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
+                    endif()
                     link_libraries(asan)
                     check_flag(-fsanitize-recover=address IGNORE)
                 endif()
@@ -62,6 +65,9 @@ function(check_debug)
                 if(HAVE_UBSAN)
                     add_compile_definitions(HAVE_UBSAN)
                     add_compile_options(-fsanitize=undefined)
+                    if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
+                        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
+                    endif()
                     link_libraries(ubsan)
                     check_flag(-fsanitize-recover=undefined IGNORE)
                 endif()