Skip to content

Commit

Permalink
build: add enable-assertions option
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed Oct 20, 2024
1 parent e6d2f30 commit fd3e992
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,18 @@ else()
message(STATUS "Debug Build")
endif()

if (upper_CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO|DEBUG" OR NOT OFFICIAL_BUILD)
option(ENABLE_ASSERTIONS "Enable assertions" ON)
else()
option(ENABLE_ASSERTIONS "Enable assertions" OFF)
endif()

if (ENABLE_ASSERTIONS)
message(STATUS "Enabled Assertions")
list(APPEND YASS_APP_FEATURES "assertions")
add_definitions(-DDCHECK_ALWAYS_ON=1)
endif()

if (ENABLE_LTO AND IS_RELEASE_BUILD)
if (COMPILER_CLANG)
if (USE_MOLD AND UNIX AND NOT APPLE)
Expand Down
2 changes: 1 addition & 1 deletion third_party/libc++/__assertion_handler
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#endif

// Based on CHECK_WILL_STREAM() defined in base/check.h
#if defined(NDEBUG) && defined(OFFICIAL_BUILD)
#if defined(OFFICIAL_BUILD) && !defined(DCHECK_ALWAYS_ON)

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down

0 comments on commit fd3e992

Please sign in to comment.