Browse Source

HPCC-23523 Only define sanitize-trap on clang 10.0 or later

Don't use sanitize except in trap mode - it gives link errors.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 5 years ago
parent
commit
58fc7c4af4
1 changed files with 2 additions and 5 deletions
  1. 2 5
      cmake_modules/commonSetup.cmake

+ 2 - 5
cmake_modules/commonSetup.cmake

@@ -339,11 +339,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   if (CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
     add_definitions (-fvisibility=hidden)
   endif ()
-  if (CMAKE_COMPILER_IS_CLANGXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
-    add_definitions (-fsanitize=undefined -fno-sanitize=alignment)
-    if (NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "11.0.0")
-      add_definitions (-fsanitize-trap=undefined)
-    endif()
+  if (CMAKE_COMPILER_IS_CLANGXX AND CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "10.0.0")
+    add_definitions (-fsanitize=undefined -fno-sanitize=alignment -fsanitize-trap=undefined)
     SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=undefined")
     SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
   endif ()