automoc does not respect Q_OS_ defines on Mac
CMake 3.11.2, Qt5 project
My observation is that moc_predefs.h is absent in the CMake build dir.
Compilation fails because moc does not see Q_OS_ macro values in the following fragment:
#include <QObject>
class TestClass: public QObject {
Q_OBJECT
public Q_SLOTS:
#ifndef Q_OS_MAC
void notDefMac();
#else
void elseNotDedMac();
#endif
#ifdef Q_OS_MAC
void defMac();
#endif
};
The generated moc_ file contains reference to the notDefMac()
function. Building with qmake passes.
Test project attached.