Revert "[cmake] remove -O? from debug cxx flags"

This reverts commit b5e571fc9ad2240d510514566c0946b2cce23426.
[cmake] use CACHE STRING for cxx flags