diff --git a/src/core/tests/CMakeLists.txt b/src/core/tests/CMakeLists.txt index de58ad18f9a..cba7fcf6808 100644 --- a/src/core/tests/CMakeLists.txt +++ b/src/core/tests/CMakeLists.txt @@ -2,7 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT ENABLE_SANITIZER) + # gold linker on ubuntu20.04 may fail to link binaries build with sanitizer set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") endif() diff --git a/src/tests_deprecated/unit/CMakeLists.txt b/src/tests_deprecated/unit/CMakeLists.txt index 7184853e195..9c5a997f4a9 100644 --- a/src/tests_deprecated/unit/CMakeLists.txt +++ b/src/tests_deprecated/unit/CMakeLists.txt @@ -124,7 +124,8 @@ target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_lp_transformations ) -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT ENABLE_SANITIZER) + # gold linker on ubuntu20.04 may fail to link binaries build with sanitizer set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") endif()