From a3b35a2aa4fca28c75c1acc2c1d09529c1480470 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 21 Oct 2019 17:26:27 -0700 Subject: [PATCH] Fix some unreliable STREQUAL calls in CMakeLists.txt These conditionals may fail if the variable they're checking isn't defined at all. Adding quotes makes the comparison against an empty string in this case, which avoids the syntax error. Signed-off-by: Scott K Logan --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b20cc9..f7aaa38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,17 +170,17 @@ endif() # the address sanitizer for ordinary debug builds; gcc is giving some grief on # Travis, so don't enable it for gcc by default if(NOT USE_SANITIZER) - if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" AND - NOT (${CMAKE_GENERATOR} STREQUAL "Xcode") AND - (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" - OR ${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang")) + if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND + NOT ("${CMAKE_GENERATOR}" STREQUAL "Xcode") AND + ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" + OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")) message(STATUS "Enabling address sanitizer; set USE_SANITIZER=none to prevent this") set(USE_SANITIZER address) else() set(USE_SANITIZER none) endif() endif() -if(NOT (${USE_SANITIZER} STREQUAL "none")) +if(NOT ("${USE_SANITIZER}" STREQUAL "none")) message(STATUS "Sanitizer set to ${USE_SANITIZER}") add_compile_options(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER}) link_libraries(-fno-omit-frame-pointer -fsanitize=${USE_SANITIZER})