|
|
@@ -392,8 +392,8 @@ void cmQtAutoGenerators::Init()
|
|
|
this->TargetBuildSubDir = this->TargetName;
|
|
|
this->TargetBuildSubDir += ".dir/";
|
|
|
|
|
|
- this->OutMocCppFilenameRel = this->TargetName;
|
|
|
- this->OutMocCppFilenameRel += ".cpp";
|
|
|
+ this->OutMocCppFilenameRel = this->TargetBuildSubDir;
|
|
|
+ this->OutMocCppFilenameRel += "moc_compilation.cpp";
|
|
|
|
|
|
this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
|
|
|
|
|
|
@@ -480,10 +480,10 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
|
|
|
// the program goes through all .cpp files to see which moc files are
|
|
|
// included. It is not really interesting how the moc file is named, but
|
|
|
// what file the moc is created from. Once a moc is included the same moc
|
|
|
- // may not be included in the _automoc.cpp file anymore. OTOH if there's a
|
|
|
- // header containing Q_OBJECT where no corresponding moc file is included
|
|
|
- // anywhere a moc_<filename>.cpp file is created and included in
|
|
|
- // the _automoc.cpp file.
|
|
|
+ // may not be included in the moc_compilation.cpp file anymore. OTOH if
|
|
|
+ // there's a header containing Q_OBJECT where no corresponding moc file
|
|
|
+ // is included anywhere a moc_<filename>.cpp file is created and included in
|
|
|
+ // the moc_compilation.cpp file.
|
|
|
|
|
|
// key = moc source filepath, value = moc output filepath
|
|
|
std::map<std::string, std::string> includedMocs;
|
|
|
@@ -1041,30 +1041,34 @@ bool cmQtAutoGenerators::GenerateMocFiles(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // compose _automoc.cpp content
|
|
|
+ // Compose moc_compilation.cpp content
|
|
|
std::string automocSource;
|
|
|
{
|
|
|
std::ostringstream outStream;
|
|
|
outStream << "/* This file is autogenerated, do not edit*/\n";
|
|
|
if (notIncludedMocs.empty()) {
|
|
|
+ // Dummy content
|
|
|
outStream << "enum some_compilers { need_more_than_nothing };\n";
|
|
|
} else {
|
|
|
+ // Includes content
|
|
|
for (std::map<std::string, std::string>::const_iterator it =
|
|
|
notIncludedMocs.begin();
|
|
|
it != notIncludedMocs.end(); ++it) {
|
|
|
- outStream << "#include \"" << it->second << "\"\n";
|
|
|
+ outStream << "#include \""
|
|
|
+ << it->second.substr(this->TargetBuildSubDir.size())
|
|
|
+ << "\"\n";
|
|
|
}
|
|
|
}
|
|
|
outStream.flush();
|
|
|
automocSource = outStream.str();
|
|
|
}
|
|
|
|
|
|
- // check if we even need to update _automoc.cpp
|
|
|
+ // Check if we even need to update moc_compilation.cpp
|
|
|
if (!automocCppChanged) {
|
|
|
- // compare contents of the _automoc.cpp file
|
|
|
+ // compare contents of the moc_compilation.cpp file
|
|
|
const std::string oldContents = ReadAll(this->OutMocCppFilenameAbs);
|
|
|
if (oldContents == automocSource) {
|
|
|
- // nothing changed: don't touch the _automoc.cpp file
|
|
|
+ // nothing changed: don't touch the moc_compilation.cpp file
|
|
|
if (this->Verbose) {
|
|
|
std::ostringstream err;
|
|
|
err << "AUTOGEN: " << this->OutMocCppFilenameRel << " still up to date"
|
|
|
@@ -1075,7 +1079,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // actually write _automoc.cpp
|
|
|
+ // Actually write moc_compilation.cpp
|
|
|
{
|
|
|
std::string msg = "Generating MOC compilation ";
|
|
|
msg += this->OutMocCppFilenameRel;
|