diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-08-27 19:39:50 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2012-08-27 19:39:50 (GMT) |
commit | b001b6e129134e88dc958cecbcd4c326e8daf36a (patch) | |
tree | b16d2512109718aa490bb4c728135a529fe11748 /Source/cmQtAutomoc.cxx | |
parent | c478d55e31e65205e4948bf8b487363891a638a4 (diff) | |
download | CMake-b001b6e129134e88dc958cecbcd4c326e8daf36a.zip CMake-b001b6e129134e88dc958cecbcd4c326e8daf36a.tar.gz CMake-b001b6e129134e88dc958cecbcd4c326e8daf36a.tar.bz2 |
fix #13494: rerun automoc also if include dirs or moc options change
Until now it was only rerun if the compile definitions changed, but
of course it also has to rerun if the include dirs or moc options
change. Strange that I didn't notice this before...
Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 65ecdf7..71feffd 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -321,12 +321,31 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); + this->CurrentCompileSettingsStr = this->MakeCompileSettingsString(makefile); + this->RelaxedMode = makefile->IsOn("AM_RELAXED_MODE"); return true; } +std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile) +{ + std::string s; + s += makefile->GetSafeDefinition("AM_MOC_DEFINITIONS"); + s += " ~~~ "; + s += makefile->GetSafeDefinition("AM_MOC_INCLUDES"); + s += " ~~~ "; + s += makefile->GetSafeDefinition("AM_MOC_OPTIONS"); + s += " ~~~ "; + s += makefile->IsOn("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE") ? "TRUE" + : "FALSE"; + s += " ~~~ "; + + return s; +} + + bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, const char* targetDirectory) { @@ -336,8 +355,8 @@ bool cmQtAutomoc::ReadOldMocDefinitionsFile(cmMakefile* makefile, if (makefile->ReadListFile(0, filename.c_str())) { - this->OldMocDefinitionsStr = - makefile->GetSafeDefinition("AM_OLD_MOC_DEFINITIONS"); + this->OldCompileSettingsStr = + makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS"); } return true; } @@ -352,9 +371,9 @@ void cmQtAutomoc::WriteOldMocDefinitionsFile(const char* targetDirectory) std::fstream outfile; outfile.open(filename.c_str(), std::ios::out | std::ios::trunc); - outfile << "set(AM_OLD_MOC_DEFINITIONS " + outfile << "set(AM_OLD_COMPILE_SETTINGS " << cmLocalGenerator::EscapeForCMake( - this->Join(this->MocDefinitions, ' ').c_str()) << ")\n"; + this->CurrentCompileSettingsStr.c_str()) << ")\n"; outfile.close(); } @@ -471,7 +490,7 @@ void cmQtAutomoc::Init() bool cmQtAutomoc::RunAutomoc() { if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str()) - || (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' '))) + || (this->OldCompileSettingsStr != this->CurrentCompileSettingsStr)) { this->GenerateAll = true; } |