Revert "Revert "Use CMAKE_BUILD_TYPE""

This reverts commit 9b7b16253ec0a72244e14aed1ae1fd1a144b7433.

It was actually working.