From 7f6947734004eab0f9a6b55d16139549796327b4 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Fri, 17 Feb 2023 15:02:31 +0800 Subject: [PATCH] Use -O0 for debug build (#695) Signed-off-by: Yudong Cai --- cmake/utils/compile_flags.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/utils/compile_flags.cmake b/cmake/utils/compile_flags.cmake index f83e816ac..b407e91b8 100644 --- a/cmake/utils/compile_flags.cmake +++ b/cmake/utils/compile_flags.cmake @@ -17,16 +17,15 @@ endif() if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") message(STATUS "Build in Debug mode") - set(CMAKE_CXX_FLAGS "-O1 -g -Wall -fPIC ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-O0 -g -Wall -fPIC ${CMAKE_CXX_FLAGS}") if(USE_CUDA) set(CMAKE_CUDA_FLAGS - "-O1 -g -Xcompiler=-w -Xcompiler=-fPIC ${CMAKE_CUDA_FLAGS}") + "-O0 -g -Xcompiler=-w -Xcompiler=-fPIC ${CMAKE_CUDA_FLAGS}") endif() else() set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC ${CMAKE_CXX_FLAGS}") - if(USE_CUDA) set(CMAKE_CUDA_FLAGS - "-O2 -Xcompiler=-w -Xcompiler=-fPIC ${CMAKE_CUDA_FLAGS}") + "-O2 -Xcompiler=-w -Xcompiler=-fPIC ${CMAKE_CUDA_FLAGS}") endif() endif()