Skip to content

Commit

Permalink
Check /etc/os-release instead of apt presence in CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
p-senichenkov committed Jan 6, 2025
1 parent e2e16b3 commit 240016d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 240016d

Please sign in to comment.