Skip to content

Commit 532820e

Browse files
authored
Fix out variable in cmake sanitizer module (#1134)
1 parent fee7aa6 commit 532820e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmake/AwsSanitizers.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ set(SANITIZERS "address;undefined" CACHE STRING "List of sanitizers to build wit
1111
# sanitizer: The sanitizer to check
1212
# out_variable: The variable to assign the result to. Defaults to HAS_SANITIZER_${sanitizer}
1313
function(aws_check_sanitizer sanitizer)
14-
15-
if(NOT ${ARGN})
16-
set(out_variable "${ARGN}")
17-
else()
14+
list(LENGTH ARGN extra_count)
15+
if(${extra_count} EQUAL 0)
1816
set(out_variable HAS_SANITIZER_${sanitizer})
1917
# Sanitize the variable name to remove illegal characters
2018
string(MAKE_C_IDENTIFIER ${out_variable} out_variable)
19+
elseif(${extra_count} EQUAL 1)
20+
set(out_variable ${ARGN})
21+
else()
22+
message(FATAL_ERROR "Error: aws_check_sanitizer() called with multiple out variables")
2123
endif()
2224

2325
if(ENABLE_SANITIZERS)

0 commit comments

Comments
 (0)