[CMAKE] Use the same debug flags for C and C++
Summary:
This diff extends the some Debug compilation flags to also apply to the
C files. Now they can use -g3 when available as well as -ftrapv.
The optimization level remains unchanged for now. It can likely be
improved but having the same -O0 optimization causes ASAN to fail on
assembly code with Clang, so it needs special care.
Test Plan:
cmake -GNinja .. -DCMAKE_BUILD_TYPE=Debug ninja -v check-all
Check in the output that the -g3 flag is used for both C and C++
(I couldn't find a compiler that doesn't support -g3).
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D4960