Apparently COMPILE_FLAGS can be empty.
Try again with CMake-ism: handle empty COMPILE_FLAGS.
Fix for ROOT-5337
Move dynamic_cast into assert, it's only for debug

and not checked in release.
Move debug dynamic_casts into asserts to make them noop in release.
Formatting.
Typo.