| 866 | } |
| 867 | |
| 868 | void cmQtAutoMocUicT::JobMocPredefsT::Process() |
| 869 | { |
| 870 | // (Re)generate moc_predefs.h on demand |
| 871 | std::unique_ptr<std::string> reason; |
| 872 | if (this->Log().Verbose()) { |
| 873 | reason = cm::make_unique<std::string>(); |
| 874 | } |
| 875 | if (!this->Update(reason.get())) { |
| 876 | return; |
| 877 | } |
| 878 | std::string const& predefsFileAbs = this->MocConst().PredefsFileAbs; |
| 879 | { |
| 880 | cmWorkerPool::ProcessResultT result; |
| 881 | { |
| 882 | // Compose command |
| 883 | std::vector<std::string> cmd = this->MocConst().PredefsCmd; |
| 884 | // Add definitions |
| 885 | cm::append(cmd, this->MocConst().OptionsDefinitions); |
| 886 | // Add includes |
| 887 | cm::append(cmd, this->MocConst().OptionsIncludes); |
| 888 | // Check if response file is necessary |
| 889 | MaybeWriteResponseFile(this->MocConst().PredefsFileAbs, cmd); |
| 890 | |
| 891 | // Execute command |
| 892 | if (!this->RunProcess(GenT::MOC, result, cmd, reason.get())) { |
| 893 | this->LogCommandError(GenT::MOC, |
| 894 | cmStrCat("The content generation command for ", |
| 895 | this->MessagePath(predefsFileAbs), |
| 896 | " failed.\n", result.ErrorMessage), |
| 897 | cmd, result.StdOut); |
| 898 | return; |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | // (Re)write predefs file only on demand |
| 903 | if (cmQtAutoGenerator::FileDiffers(predefsFileAbs, result.StdOut)) { |
| 904 | if (!cmQtAutoGenerator::FileWrite(predefsFileAbs, result.StdOut)) { |
| 905 | this->LogError( |
| 906 | GenT::MOC, |
| 907 | cmStrCat("Writing ", this->MessagePath(predefsFileAbs), " failed.")); |
| 908 | return; |
| 909 | } |
| 910 | } else { |
| 911 | // Touch to update the time stamp |
| 912 | if (this->Log().Verbose()) { |
| 913 | this->Log().Info(GenT::MOC, |
| 914 | "Touching " + this->MessagePath(predefsFileAbs)); |
| 915 | } |
| 916 | if (!cmSystemTools::Touch(predefsFileAbs, false)) { |
| 917 | this->LogError(GenT::MOC, |
| 918 | cmStrCat("Touching ", this->MessagePath(predefsFileAbs), |
| 919 | " failed.")); |
| 920 | return; |
| 921 | } |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | // Read file time afterwards |
nothing calls this directly
no test coverage detected