diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-11-30 21:51:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:23:59 (GMT) |
commit | 6f53b1ab642ca1e5977121ec60779f248cf8ee88 (patch) | |
tree | c1c39311fbaaf7e7f7929764151413bf3dd4ee38 /Source | |
parent | 39e07d7a175d5da0c1a2ebc905689705571d2084 (diff) | |
download | CMake-6f53b1ab642ca1e5977121ec60779f248cf8ee88.zip CMake-6f53b1ab642ca1e5977121ec60779f248cf8ee88.tar.gz CMake-6f53b1ab642ca1e5977121ec60779f248cf8ee88.tar.bz2 |
QtAutogen: Generate moc compilation in _automoc.dir/moc_compilation.cpp
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 10 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 28 |
2 files changed, 19 insertions, 19 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index de70d34..a443934 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -650,14 +650,10 @@ static void RccSetupAutoTarget(cmGeneratorTarget const* target) void cmQtAutoGeneratorInitializer::InitializeAutogenSources( cmGeneratorTarget* target) { - cmMakefile* makefile = target->Target->GetMakefile(); - if (target->GetPropertyAsBool("AUTOMOC")) { - std::string automocTargetName = GetAutogenTargetName(target); - std::string mocCppFile = makefile->GetCurrentBinaryDirectory(); - mocCppFile += "/"; - mocCppFile += automocTargetName; - mocCppFile += ".cpp"; + cmMakefile* makefile = target->Target->GetMakefile(); + std::string mocCppFile = GetAutogenTargetBuildDir(target); + mocCppFile += "moc_compilation.cpp"; makefile->GetOrCreateSource(mocCppFile, true); makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(), false); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f90f0d5..e5d7b57 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -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; |