Autogen: Generators: Use FileAbsentOrOlder for MOC tests

This commit is contained in:
Sebastian Holtermann
2017-01-13 00:00:43 +01:00
parent 119791ae52
commit ca179f2afc
+7 -4
View File
@@ -1121,10 +1121,13 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
const std::string mocFileRel =
this->AutogenBuildSubDir + subDirPrefix + mocFileName;
const std::string mocFileAbs = this->CurrentBinaryDir + mocFileRel;
int sourceNewerThanMoc = 0;
bool success = cmsys::SystemTools::FileTimeCompare(sourceFile, mocFileAbs,
&sourceNewerThanMoc);
if (this->GenerateAll || !success || sourceNewerThanMoc >= 0) {
bool generateMoc = this->GenerateAll;
// Test if the source file is newer that the build file
if (!generateMoc) {
generateMoc = FileAbsentOrOlder(mocFileAbs, sourceFile);
}
if (generateMoc) {
// Log
this->LogBold("Generating MOC source " + mocFileRel);