Skip to content
Snippets Groups Projects
Commit 16b9331f authored by Louis Montaut's avatar Louis Montaut
Browse files

fwd: add macro to turn assert into exception

parent 64623188
No related branches found
No related tags found
No related merge requests found
......@@ -130,6 +130,8 @@ else()
CHECK_MINIMAL_CXX_STANDARD(14 ENFORCE)
endif()
option(HPP_FCL_TURN_ASSERT_INTO_EXCEPTION "turn some critical HPP-FCL asserts to exception." FALSE)
# Optional dependencies
ADD_PROJECT_DEPENDENCY(octomap PKG_CONFIG_REQUIRES "octomap >= 1.6")
if(octomap_FOUND)
......
......@@ -70,6 +70,19 @@
throw exception(ss.str()); \
}
#ifdef HPP_FCL_TURN_ASSERT_INTO_EXCEPTION
#define HPP_FCL_ASSERT(check, message, exception) \
{ \
if (!check) HPP_FCL_THROW_PRETTY(message, exception); \
}
#else
#define HPP_FCL_ASSERT(check, message, exception) \
{ \
HPP_FCL_UNUSED_VARIABLE(exception(message)); \
assert(check&& message); \
}
#endif
#if (__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
#define HPP_FCL_WITH_CXX11_SUPPORT
#endif
......
......@@ -210,6 +210,10 @@ IF(WIN32)
)
ENDIF(WIN32)
if (HPP_FCL_TURN_ASSERT_INTO_EXCEPTION)
target_compile_definitions(${LIBRARY_NAME} PRIVATE -DHPP_FCL_TURN_ASSERT_INTO_EXCEPTION)
endif()
if(HPP_FCL_HAS_QHULL)
target_compile_definitions(${LIBRARY_NAME} PRIVATE -DHPP_FCL_HAS_QHULL)
if (HPP_FCL_USE_SYSTEM_QHULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment