Enable building in Debug mode if the user really wants this (#230)

Also inform the user about slow performance if they do this.
master
Juraj Oršulić 2017-03-30 17:00:50 +02:00 committed by Wolfgang Hess
parent cb0d1a6d5a
commit 2854c485ef
1 changed files with 10 additions and 1 deletions

View File

@ -99,7 +99,16 @@ macro(google_initialize_cartographer_project)
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
google_add_flag(GOOG_CXX_FLAGS "-O3 -g -DNDEBUG") google_add_flag(GOOG_CXX_FLAGS "-O3 -g -DNDEBUG")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") 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() else()
message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
endif() endif()