From 240016d642263c5bf1edeb1d05e50432037bf258 Mon Sep 17 00:00:00 2001 From: Senichenkov Date: Mon, 6 Jan 2025 18:02:09 +0300 Subject: [PATCH] Check /etc/os-release instead of apt presence in CMakeLists --- CMakeLists.txt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 536d3b845..90ebcce5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,18 +75,15 @@ else() # Set DEBUG build options specific for build with ASAN set(ASAN_OPTS "-fsanitize=address") - find_program(APT_FOUND apt-get) - if (APT_FOUND AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + execute_process(COMMAND grep -q "Ubuntu" /etc/ose-release RESULT_VARIABLE IS_UBUNTU) + if (IS_UBUNTU AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # alloc-dealloc-mismatch generates false positives on boost exceptions # This applies only to Ubuntu package: # https://github.com/llvm/llvm-project/issues/59432?ysclid=m4y0iqca2c577414782 # Disable this check on files listed in address_sanitizer_ignore_list.txt if compiler - # is Clang and apt-get is installed on system: - # FIXME(senichenkov): apt-get is not an ideal check -- maybe it wouldn't be so hard to - # ask apt-get if repository is ubuntu-...? - message("Running on Ubuntu") - message(WARNING "ASAN is broken in Ubuntu package, therefore alloc-dealloc-mismatch") - message(WARNING "check will be supressed. Consider using another distro for full ASAN coverage.") + # is Clang and host distro is Ubuntu: + message(WARNING "Running on Ubuntu. ASAN is broken in Ubuntu package, therefore alloc-dealloc-mismatch check will be supressed. + Consider using another distro for full ASAN coverage") string(JOIN ";" ASAN_OPTS "-fsanitize-ignorelist=${CMAKE_SOURCE_DIR}/address_sanitizer_ignore_list.txt") endif()