diff -up cmake-3.10.2/Source/cmQtAutoGenerators.cxx.automoc cmake-3.10.2/Source/cmQtAutoGenerators.cxx --- cmake-3.10.2/Source/cmQtAutoGenerators.cxx.automoc 2018-01-18 07:48:42.000000000 -0700 +++ cmake-3.10.2/Source/cmQtAutoGenerators.cxx 2018-03-08 21:09:50.451726324 -0700 @@ -80,8 +80,8 @@ static bool ReadFile(std::string& conten std::size_t const length = cmSystemTools::FileLength(filename); cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); if (ifs) { - content.resize(length); - ifs.read(&content.front(), content.size()); + content.reserve(length); + content.assign(std::istreambuf_iterator{ifs}, {}); if (ifs) { success = true; } else {