| 2960 | } |
| 2961 | |
| 2962 | bool cmQtAutoMocUicT::SettingsFileWrite() |
| 2963 | { |
| 2964 | // Only write if any setting changed |
| 2965 | if (this->MocConst().SettingsChanged || this->UicConst().SettingsChanged) { |
| 2966 | if (this->Log().Verbose()) { |
| 2967 | this->Log().Info(GenT::GEN, |
| 2968 | cmStrCat("Writing the settings file ", |
| 2969 | this->MessagePath(this->SettingsFile_))); |
| 2970 | } |
| 2971 | // Compose settings file content |
| 2972 | std::string content; |
| 2973 | { |
| 2974 | auto SettingAppend = [&content](cm::string_view key, |
| 2975 | cm::string_view value) { |
| 2976 | if (!value.empty()) { |
| 2977 | content += cmStrCat(key, ':', value, '\n'); |
| 2978 | } |
| 2979 | }; |
| 2980 | SettingAppend("moc", this->SettingsStringMoc_); |
| 2981 | SettingAppend("uic", this->SettingsStringUic_); |
| 2982 | } |
| 2983 | // Write settings file |
| 2984 | std::string error; |
| 2985 | if (!cmQtAutoGenerator::FileWrite(this->SettingsFile_, content, &error)) { |
| 2986 | this->Log().Error(GenT::GEN, |
| 2987 | cmStrCat("Writing the settings file ", |
| 2988 | this->MessagePath(this->SettingsFile_), |
| 2989 | " failed.\n", error)); |
| 2990 | // Remove old settings file to trigger a full rebuild on the next run |
| 2991 | cmSystemTools::RemoveFile(this->SettingsFile_); |
| 2992 | return false; |
| 2993 | } |
| 2994 | } |
| 2995 | return true; |
| 2996 | } |
| 2997 | |
| 2998 | void cmQtAutoMocUicT::ParseCacheRead() |
| 2999 | { |