aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorEvan Nemerson <evan@nemerson.com>2016-07-26 08:22:58 -0700
committerEvan Nemerson <evan@nemerson.com>2016-07-26 17:31:26 -0700
commit26a59359eda3b70081e57389c4496b86ec5622c2 (patch)
tree98a5088bb129eebcb51ebe423e9d83bad88ffe9b /CMakeLists.txt
parent45862fcb063f6fcace2f57b5d882a747cd651242 (diff)
downloadbrotli-26a59359eda3b70081e57389c4496b86ec5622c2.tar.gz
Add UBSan build, use clang for sanitizer builds.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2839323..9d55711 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,12 @@ if (ENABLE_SANITIZER)
set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${ENABLE_SANITIZER}")
+
+ # By default, brotli depends on undefined behavior, but setting
+ # BROTLI_BUILD_PORTABLE should result in a build which does not.
+ if(ENABLE_SANITIZER STREQUAL "undefined")
+ add_definitions(-DBROTLI_BUILD_PORTABLE)
+ endif()
endif ()
set(BROTLI_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")