Add build debug flag

This PR activates the `DEBUG` definition if the build type is `Debug`.
It also aims at fixing the issues surfacing when building with `-DCMAKE_BUILD_TYPE=Debug`.
Note that this PR is both incomplete and blocked by issue #224 atm.