Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cmake/AwsSanitizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0.

include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)

option(ENABLE_SANITIZERS "Enable sanitizers in debug builds" OFF)
set(SANITIZERS "address;undefined" CACHE STRING "List of sanitizers to build with")
Expand Down Expand Up @@ -32,7 +33,16 @@ function(aws_check_sanitizer sanitizer)

# Need to set this here so that the flag is passed to the linker
set(CMAKE_REQUIRED_FLAGS ${sanitizer_test_flag})
check_c_compiler_flag(${sanitizer_test_flag} ${out_variable})
if(${CMAKE_C_COMPILER_LOADED})
check_c_compiler_flag(${sanitizer_test_flag} ${out_variable})
endif()
if(${CMAKE_CXX_COMPILER_LOADED})
check_cxx_compiler_flag(${sanitizer_test_flag} ${out_variable})
endif()

if(NOT ${out_variable})
message(STATUS "Check ${out_variable} failed")
endif()
else()
set(${out_variable} 0 PARENT_SCOPE)
endif()
Expand Down