[PATCH 1/2] build: Enable debug symbols for debug builds

  • From: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sun, 25 Feb 2018 11:50:01 +0100

This sets the "-g" compiler flag if the build is not "Release" so that
the sanitizers correctly display line numbers in their output.

Signed-off-by: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
---
 CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8421199..0bbddd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,6 +86,8 @@ 
test_and_set_c_compiler_flag_global(-Wdeclaration-after-statement)
 test_and_set_c_compiler_flag_global(-fmax-errors=5)
 if (CMAKE_BUILD_TYPE STREQUAL "Release")
   test_and_set_c_compiler_flag_global(-O3)
+else ()
+  test_and_set_c_compiler_flag_global(-g)
 endif ()
 if (CMAKE_BUILD_TYPE STREQUAL "DebugASan")
   test_and_set_c_compiler_flag_global(-fsanitize=address)
-- 
2.16.2


Other related posts:

  • » [PATCH 1/2] build: Enable debug symbols for debug builds - Dimitri Staessens