From 569b29254294478356859c92110e1fb343cca346 Mon Sep 17 00:00:00 2001 From: superp00t Date: Mon, 24 Mar 2025 20:12:56 -0400 Subject: [PATCH] feat(build): add option (WHOA_ASSERTIONS_ENABLED) to toggle assertions independently from CMAKE_BUILD_TYPE --- cmake/system.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmake/system.cmake b/cmake/system.cmake index 7a69790..40eaeea 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -88,3 +88,17 @@ elseif(${WHOA_SYSTEM_LINUX}) add_definitions(-DWHOA_SYSTEM_VERSION=${WHOA_SYSTEM_VERSION}) endif() + +# Toggle assertions +if(NOT DEFINED WHOA_ASSERTIONS_ENABLED) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(WHOA_ASSERTIONS_ENABLED 1) + else() + set(WHOA_ASSERTIONS_ENABLED 0) + endif() +endif() + +if(WHOA_ASSERTIONS_ENABLED) + add_definitions(-DWHOA_ASSERTIONS_ENABLED=1) +endif() +