CMake: fix behavior of CMAKE_BUILD_TYPE when set via command line
argument. Variable is cached and read from cli args. Default is
again RelWithDebInfo
Fix compiler warnings concerning cast style.
Remove unneeded functions and corresponding file