mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
Process C++ module interface and partition units that are members of a FILE_SET of type CXX_MODULES. moc is run on such units and its generated output is compiled as a module implementation unit of the same module, as its own scanned translation unit rather than folded into mocs_compilation.cpp. Macro-less units get an empty placeholder; module units and their dependencies are tracked in the autogen depfile and as byproducts for correct incremental rebuilds. This requires Qt 6.13, whose moc supports C++ module units. With older Qt nothing can be generated for a module unit, so a meta-object macro found in one is reported as an error rather than left to fail later in the compiler or the linker. Such a unit is no longer handled as an ordinary source, which also means its moc include directives are not honored and AUTOUIC does not process it. moc rejects a meta-object macro in a module implementation unit or a private module fragment, and AUTOMOC does not work around that.
15 lines
410 B
C++
15 lines
410 B
C++
module;
|
|
#include <QObject>
|
|
module Mod;
|
|
|
|
// The implementation partition is imported here rather than from mod.cppm,
|
|
// where Clang diagnoses it with
|
|
// -Wimport-implementation-partition-unit-in-interface-unit. Referencing the
|
|
// meta-object makes the link fail if AUTOMOC did not moc mod-internal.cppm.
|
|
import :Internal;
|
|
|
|
int internalMethodCount()
|
|
{
|
|
return InternalObject::staticMetaObject.methodCount();
|
|
}
|