Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IS_CXX option to sanitizer cmake module #1135

Closed
wants to merge 4 commits into from
Closed
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
8 changes: 7 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,12 @@ 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()
else()
set(${out_variable} 0 PARENT_SCOPE)
endif()
Expand Down
Loading