Fixed one bug and CMake checks for gcc version to append one flag