diff --git a/cmake/functions.cmake b/cmake/functions.cmake index fbf2af1a33..1cdd9ee3ae 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -99,7 +99,14 @@ macro(google_initialize_cartographer_project) elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") google_add_flag(GOOG_CXX_FLAGS "-O3 -g -DNDEBUG") elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") - message(FATAL_ERROR "Compiling in debug mode is not supported.") + if(NOT FORCE_DEBUG_BUILD) + message(FATAL_ERROR + "Compiling in debug mode is not supported and can cause severely degraded performance. \ + If you wish to continue anyway, call CMake with -DFORCE_DEBUG_BUILD=True") + else() + message(WARNING "Building in Debug mode, expect very slow performance.") + google_add_flag(GOOG_CXX_FLAGS "-g") + endif() else() message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") endif()