From f9addb242713117cb95f49a26abe2aa128d0d5ef Mon Sep 17 00:00:00 2001 From: Chris Djali Date: Thu, 5 Feb 2026 03:57:21 +0000 Subject: [PATCH] Make RECASTNAVIGATION_ENABLE_ASSERTS do what it looks like it does (#806) --- CMakeLists.txt | 5 +---- Detour/CMakeLists.txt | 4 +--- Recast/CMakeLists.txt | 4 +--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6911aa636..908de4e28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ option(RECASTNAVIGATION_TESTS "Build tests" ON) option(RECASTNAVIGATION_EXAMPLES "Build examples" ON) option(RECASTNAVIGATION_DT_POLYREF64 "Use 64bit polyrefs instead of 32bit for Detour" OFF) option(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER "Use dynamic dispatch for dtQueryFilter in Detour to allow for custom filters" OFF) -option(RECASTNAVIGATION_ENABLE_ASSERTS "Enable custom recastnavigation asserts" "$,ON,OFF>") +set(RECASTNAVIGATION_ENABLE_ASSERTS "$" CACHE STRING "Condition to enable custom recastnavigation asserts, evaluated as generator expression") option(RECASTNAVIGATION_ENABLE_FAST_MATH "Enable faster math calculations." OFF) # dll export @@ -62,9 +62,6 @@ if(NOT MSVC) add_compile_options(-g) endif() -# Release optimizations and disable asserts -add_compile_definitions($<$>:RC_DISABLE_ASSERTS>) - configure_file( "${RecastNavigation_SOURCE_DIR}/version.h.in" "${RecastNavigation_BINARY_DIR}/version.h") diff --git a/Detour/CMakeLists.txt b/Detour/CMakeLists.txt index 176ce38c3..662782d38 100644 --- a/Detour/CMakeLists.txt +++ b/Detour/CMakeLists.txt @@ -22,9 +22,7 @@ if (RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER) target_compile_definitions(Detour PUBLIC DT_VIRTUAL_QUERYFILTER) endif() -if (NOT RECASTNAVIGATION_ENABLE_ASSERTS) - target_compile_definitions(Detour PUBLIC RC_DISABLE_ASSERTS) -endif() +target_compile_definitions(Detour PUBLIC "$<$:RC_DISABLE_ASSERTS>") # Set include path set(Detour_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include") diff --git a/Recast/CMakeLists.txt b/Recast/CMakeLists.txt index 26b5d8251..e9290ce1d 100644 --- a/Recast/CMakeLists.txt +++ b/Recast/CMakeLists.txt @@ -19,9 +19,7 @@ target_include_directories(Recast PUBLIC "$" ) -if (NOT RECASTNAVIGATION_ENABLE_ASSERTS) - target_compile_definitions(Recast PUBLIC RC_DISABLE_ASSERTS) -endif() +target_compile_definitions(Recast PUBLIC "$<$:RC_DISABLE_ASSERTS>") install(TARGETS Recast EXPORT recastnavigation-targets