handling of C++ compiler flags improved in main cmake file