Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (LEGACY_BUILD)
option(ANDROID_BUILD_ZLIB "When building for Android, should Zlib be built as well" ON)
option(FORCE_CURL "Forces usage of the Curl client rather than the default OS-specific api" OFF)
option(ENABLE_ADDRESS_SANITIZER "Flags to enable/disable Address Sanitizer for gcc or clang" OFF)
option(ENABLE_UB_SANITIZER "Flags to enable/disable Undefined Behavior Sanitizer for gcc or clang" OFF)
option(BYPASS_DEFAULT_PROXY "Bypass the machine's default proxy settings when using IXmlHttpRequest2" ON)
option(BUILD_DEPS "Build third-party dependencies" ON)
option(USE_OPENSSL "Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto" ON)
Expand Down Expand Up @@ -241,6 +242,10 @@ if (LEGACY_BUILD)
set(BUILD_SHARED_LIBS OFF)
endif ()
set(CRT_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
if (ENABLE_UB_SANITIZER)
set(ENABLE_SANITIZERS ON CACHE BOOL "Enable sanitizers in dependencies")
set(SANITIZERS "undefined" CACHE STRING "List of sanitizers to build with")
endif ()
add_subdirectory(crt/aws-crt-cpp)
set(BUILD_TESTING ${BUILD_TESTING_PREV})
if (ENABLE_OPENSSL_ENCRYPTION)
Expand Down Expand Up @@ -322,6 +327,10 @@ if (LEGACY_BUILD)
endif ()
endif ()

if (ENABLE_UB_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -g -fno-omit-frame-pointer")
endif ()

include(CheckCXXSymbolExists)

check_cxx_symbol_exists("pathconf" "unistd.h" HAS_PATHCONF)
Expand Down
3 changes: 3 additions & 0 deletions docs/CMake_Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ For more information, see the CMake documentation for your platform.
### ENABLE_ADDRESS_SANITIZER
(Defaults to OFF) Flags to enable/disable Address Sanitizer for gcc or clang

### ENABLE_UB_SANITIZER
(Defaults to OFF) Flags to enable/disable Undefined Behavior Sanitizer for gcc or clang

### BYPASS_DEFAULT_PROXY
(Defaults to ON) Bypass the machine's default proxy settings when using IXmlHttpRequest2

Expand Down