diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-10-22 19:16:39 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-10-22 19:16:39 (GMT) |
commit | 5e8e9ad68ca9e617ef5442236247a49e3b246a5d (patch) | |
tree | 7040108c08a216c8457910e1af5e483b5d3607f7 /Source/cmQtAutomoc.cxx | |
parent | ea8ac9f5dc2eab7b263a18eee5db75aedd31e26a (diff) | |
download | CMake-5e8e9ad68ca9e617ef5442236247a49e3b246a5d.zip CMake-5e8e9ad68ca9e617ef5442236247a49e3b246a5d.tar.gz CMake-5e8e9ad68ca9e617ef5442236247a49e3b246a5d.tar.bz2 |
automoc: always run moc on the cpp file if there is a foo.moc included
This makes automoc behaves as the documentation says.
If there is a #include "foo.moc" in the source file, moc
will be executed on foo.cpp.
Before it was also executed on foo.cpp, but only if foo.cpp
contained a Q_OBJECT macro, otherwise moc was executed on
foo.h. This was confusing, and this change also shouldn't break
anything, since the headers are moc'ed anyway if they contain
a Q_OBJECT macro.
Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index edf1d57..a839489 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -492,7 +492,6 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, cmsys::RegularExpression mocIncludeRegExp( "[\n][ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"); - cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]"); std::list<std::string> headerExtensions; headerExtensions.push_back(".h"); headerExtensions.push_back(".hpp"); @@ -536,17 +535,13 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, // the Q_OBJECT class declaration in a header file. // If the moc include is of the foo.moc style we need to look for // a Q_OBJECT macro in the current source file, if it contains the - // macro we generate the moc file from the source file, else from the - // header. + // macro we generate the moc file from the source file. // Q_OBJECT - if (moc_style || !qObjectRegExp.find(contentsString)) + if (moc_style) { - if (moc_style) - { - // basename should be the part of the moc filename used for - // finding the correct header, so we need to remove the moc_ part - basename = basename.substr(4); - } + // basename should be the part of the moc filename used for + // finding the correct header, so we need to remove the moc_ part + basename = basename.substr(4); bool headerFound = false; for(std::list<std::string>::const_iterator ext = |