Autogen: Revert processing of .hh files for compatibility

Since commit 4a9154537c (Autogen: Use cmake::IsHeader/SourceExtension
for file type detection, 2019-07-02, v3.16.0-rc1~470^2~4) we process
`.hh` files with `AUTOMOC`.  However, this change can break existing
projects that do not expect the behavior.  Revert it for now.  It can
be restored later via a policy.

Fixes: #20101
This commit is contained in:
Brad King 2019-12-18 05:28:27 -05:00
parent 4771c4e447
commit 7fa7f55230
4 changed files with 4 additions and 18 deletions

View File

@ -764,7 +764,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Register files that will be scanned by moc or uic // Register files that will be scanned by moc or uic
if (this->MocOrUicEnabled()) { if (this->MocOrUicEnabled()) {
if (cm->IsHeaderExtension(extLower)) { // FIXME: Add a policy to include .hh files.
if (cm->IsHeaderExtension(extLower) && extLower != "hh") {
addMUFile(makeMUFile(sf, fullPath, true), true); addMUFile(makeMUFile(sf, fullPath, true), true);
} else if (cm->IsSourceExtension(extLower)) { } else if (cm->IsSourceExtension(extLower)) {
addMUFile(makeMUFile(sf, fullPath, true), false); addMUFile(makeMUFile(sf, fullPath, true), false);
@ -876,7 +877,8 @@ bool cmQtAutoGenInitializer::InitScanFiles()
std::string const& extLower = std::string const& extLower =
cmSystemTools::LowerCase(sf->GetExtension()); cmSystemTools::LowerCase(sf->GetExtension());
if (cm->IsHeaderExtension(extLower)) { // FIXME: Add a policy to include .hh files.
if (cm->IsHeaderExtension(extLower) && extLower != "hh") {
if (!cmContains(this->AutogenTarget.Headers, sf)) { if (!cmContains(this->AutogenTarget.Headers, sf)) {
auto muf = makeMUFile(sf, fullPath, false); auto muf = makeMUFile(sf, fullPath, false);
if (muf->SkipMoc || muf->SkipUic) { if (muf->SkipMoc || muf->SkipUic) {

View File

@ -18,7 +18,6 @@ add_executable(sameName
ccc/data.qrc ccc/data.qrc
item.cpp item.cpp
object.h object.h
object.hh
object.h++ object.h++
object.hpp object.hpp
object.hxx object.hxx

View File

@ -6,7 +6,6 @@
#include "item.hpp" #include "item.hpp"
#include "object.h" #include "object.h"
#include "object.h++" #include "object.h++"
#include "object.hh"
#include "object.hpp" #include "object.hpp"
#include "object.hxx" #include "object.hxx"
#include "object_upper_ext.H" #include "object_upper_ext.H"
@ -22,7 +21,6 @@ int main(int argv, char** args)
::ccc::Item ccc_item; ::ccc::Item ccc_item;
// Object instances // Object instances
::Object_h obj_h; ::Object_h obj_h;
::Object_hh obj_hh;
::Object_hplpl obj_hplpl; ::Object_hplpl obj_hplpl;
::Object_hpp obj_hpp; ::Object_hpp obj_hpp;
::Object_hxx obj_hxx; ::Object_hxx obj_hxx;

View File

@ -1,13 +0,0 @@
#ifndef OBJECT_HH
#define OBJECT_HH
#include <QObject>
class Object_hh : public QObject
{
Q_OBJECT
Q_SLOT
void go(){};
};
#endif