aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-03-03 04:10:02 +0000
committerJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2021-05-19 03:52:45 +0100
commit8eacd615c8437bcb058d01d2446f8149ae9fda25 (patch)
tree28f04016f8c3754d82c7d96b1d7ddbacdd9c23a1 /CMakeLists.txt
parent1ad447aab9ecd2938e5125722374e514074425ab (diff)
Disable assertions for release builds
Currently our build generates very many warnings if G_DISABLE_ASSERT is defined. Add ws_assert() and ws_assert_not_reached() to incrementally replace existing assertions and then disable them using WS_DISABLE_ASSERT. Assertions are disabled with CMake build type Release. By default the build type is RelWithDebInfo so the current behaviour of enabling assertions by default is (for now) preserved. Add some notes to README.Developer.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e560d53de..856146d439 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -814,6 +814,15 @@ else() # ! MSVC
-DG_DISABLE_DEPRECATED
-DG_DISABLE_SINGLE_INCLUDES
)
+ if(CMAKE_VERSION VERSION_GREATER "3.11.99")
+ # Build type dependency requires support for generator expressions.
+ # add_compile_definitions() requires cmake >= 3.12.
+ add_compile_definitions(
+ $<$<OR:$<BOOL:${DISABLE_ASSERT}>,$<CONFIG:Release>>:WS_DISABLE_ASSERT>
+ )
+ elseif(DISABLE_ASSERT)
+ add_definitions(-DWS_DISABLE_ASSERT)
+ endif()
set(WIRESHARK_LD_FLAGS
# See also CheckCLinkerFlag.cmake