Skip to content

Commit

Permalink
#1469: lib: build brotli in portable mode to avoid undefined behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jun 22, 2021
1 parent 6b740c5 commit 2c19c2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/load_bundled_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ add_subdirectory(${PROJECT_LIB_DIR}/json)
set(BROTLI_DISABLE_TESTS ON)
# we need to disable bundled mode so it will install properly
set(BROTLI_BUNDLED_MODE OFF)
set(BROTLI_BUILD_PORTABLE ON)
set(BROTLI_LIBRARY brotlicommon brotlienc brotlidec)
add_subdirectory(${PROJECT_LIB_DIR}/brotli)

Expand Down
6 changes: 6 additions & 0 deletions lib/brotli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ if (ENABLE_SANITIZER)
endif()
endif ()

option(BROTLI_BUILD_PORTABLE "Make brotli not incur undefined behavior" OFF)
if (BROTLI_BUILD_PORTABLE)
message(STATUS "Building brotli in portable mode")
add_definitions(-DBROTLI_BUILD_PORTABLE)
endif()

include(CheckFunctionExists)
set(LIBM_LIBRARY)
CHECK_FUNCTION_EXISTS(log2 LOG2_RES)
Expand Down

0 comments on commit 2c19c2e

Please sign in to comment.