From 2854c485ef3e1ac162cebe41e618b09c54f2a47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Thu, 30 Mar 2017 17:00:50 +0200 Subject: [PATCH] Enable building in Debug mode if the user really wants this (#230) Also inform the user about slow performance if they do this. --- cmake/functions.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/functions.cmake b/cmake/functions.cmake index fbf2af1..e6c5b3d 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -99,7 +99,16 @@ 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(FORCE_DEBUG_BUILD) + message(WARNING "Building in Debug mode, expect very slow performance.") + google_add_flag(GOOG_CXX_FLAGS "-g") + else() + message(FATAL_ERROR + "Compiling in Debug mode is not supported and can cause severely degraded performance. " + "You should change the build type to Release. If you want to build in Debug mode anyway, " + "call CMake with -DFORCE_DEBUG_BUILD=True" + ) + endif() else() message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") endif()