Autogen: Generators: Use FileAbsentOrOlder for MOC tests

This commit is contained in:
Sebastian Holtermann
2017-01-11 14:53:20 +01:00
parent 119791ae52
commit ca179f2afc

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);