Commit 1ae44de4 authored by Ramon Nou's avatar Ramon Nou
Browse files

fix tsan

parent eade8c32
Loading
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -107,9 +107,18 @@ cmake_minimum_required(VERSION 3.10)
include(CMakePushCheckState)
include(CheckIncludeFileCXX)

# If we're not cross-compiling, try to run test executables.
# Otherwise, assume that compile + link is a sufficient check.
if (CMAKE_CROSSCOMPILING)
# If we're not cross-compiling, try to run test executables. Sanitizer runtime
# checks are not reliable during configuration (for example, ThreadSanitizer
# may reject the build environment), so use compile and link checks there too.
string(CONCAT _filesystem_check_flags
    " "
    "${CMAKE_CXX_FLAGS}"
    " ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}"
    " ${CMAKE_EXE_LINKER_FLAGS}"
    " ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE}}"
)
if (CMAKE_CROSSCOMPILING OR
    _filesystem_check_flags MATCHES "(^|[ ;])-fsanitize=[^ ;]+")
    include(CheckCXXSourceCompiles)
    macro(_cmcm_check_cxx_source code var)
        check_cxx_source_compiles("${code}" ${var})