From eaac293ed6be0ffcad622414ac5c95e11a17bc8a Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Tue, 21 Jun 2022 09:09:33 -0400 Subject: [PATCH] CMake: Improve debugging support for clang build Otherwise strings and such give errors in various debuggers. See https://bugzilla.redhat.com/show_bug.cgi?id=1740927 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee5912a66c..0d9c74db8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,6 +367,12 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) set( CMAKE_CXX_FLAGS_DEBUG "-g3 -ggdb3" ) endif() + # Clang needs this flag or wxStrings, etc. won't be viewable in the debugger + if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstandalone-debug" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstandalone-debug" ) + endif() + if( KICAD_SANITIZE_ADDRESS ) add_definitions( -DKICAD_SANITIZE_ADDRESS ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )