Skip to content

Commit 63dd4aa

Browse files
authored
Support enabling and disabling asserts for CMake builds (recastnavigation#728)
1 parent 93bd042 commit 63dd4aa

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ option(RECASTNAVIGATION_TESTS "Build tests" ON)
1414
option(RECASTNAVIGATION_EXAMPLES "Build examples" ON)
1515
option(RECASTNAVIGATION_DT_POLYREF64 "Use 64bit polyrefs instead of 32bit for Detour" OFF)
1616
option(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER "Use dynamic dispatch for dtQueryFilter in Detour to allow for custom filters" OFF)
17+
option(RECASTNAVIGATION_ENABLE_ASSERTS "Enable custom recastnavigation asserts" "$<IF:$<CONFIG:Debug>,ON,OFF>")
1718

1819
if(MSVC AND BUILD_SHARED_LIBS)
1920
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

Detour/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ if(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER)
1313
target_compile_definitions(Detour PUBLIC DT_VIRTUAL_QUERYFILTER)
1414
endif()
1515

16+
if(NOT RECASTNAVIGATION_ENABLE_ASSERTS)
17+
target_compile_definitions(Detour PUBLIC RC_DISABLE_ASSERTS)
18+
endif()
19+
1620
target_include_directories(Detour PUBLIC
1721
"$<BUILD_INTERFACE:${Detour_INCLUDE_DIR}>"
1822
)

Recast/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ target_include_directories(Recast PUBLIC
1010
"$<BUILD_INTERFACE:${Recast_INCLUDE_DIR}>"
1111
)
1212

13+
if(NOT RECASTNAVIGATION_ENABLE_ASSERTS)
14+
target_compile_definitions(Recast PUBLIC RC_DISABLE_ASSERTS)
15+
endif()
16+
1317
set_target_properties(Recast PROPERTIES
1418
SOVERSION ${SOVERSION}
1519
VERSION ${LIB_VERSION}

0 commit comments

Comments
 (0)