Make sure USE_SANITIZER is not empty before foreach

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
Christophe Bedard 2020-02-29 11:53:33 -05:00 committed by eboasson
parent ca4b5a368f
commit dc57685ac3

View file

@ -173,7 +173,8 @@ endif()
# Make it easy to enable Clang's/gcc's analyzers
set(USE_SANITIZER "" CACHE STRING "Sanitizers to enable on the build.")
foreach(san "${USE_SANITIZER}")
if(NOT("${USE_SANITIZER}" STREQUAL ""))
foreach(san "${USE_SANITIZER}")
message(STATUS "Enabling sanitizer: '${san}'")
if("${san}" STREQUAL address)
@ -185,7 +186,8 @@ foreach(san "${USE_SANITIZER}")
add_compile_options("-fsanitize=${san}")
link_libraries("-fsanitize=${san}")
endif()
endforeach()
endforeach()
endif()
include(GNUInstallDirs)