Our project is using very strict set of warnings, but Qt5 generated moc files produce code that violates these warnings. We could obviously turn off the warnings globally, but I'd like to just suppress the warnings for the automoc files.
For example:
In file included from /Users/stebro/client/build/NotificationServer/Notification_automoc.cpp:2:
/Users/stebro/client/build/NotificationServer/moc_NotificationServer.cpp:100:18: error: dereference of type '_t *' (aka 'void (carbonite::NotificationServer::**)(const QByteArray &, const QString, const QVariant)') that was reinterpret_cast from type 'void **' has undefined behavior [-Werror,-Wundefined-reinterpret-cast]
if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&NotificationServer::notificationQueued)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following doesn't work:
set_property(
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
PROPERTY COMPILE_DEFINITIONS -Wundefined-reinterpret-cast
)
cmake complains:
set_property DIRECTORY scope provided but requested directory was not
found. This could be because the directory argument was invalid or, it is
valid but has not been processed yet.
I can't use set_property(FILE ...) because I don't have a comprehensive list of files that are automoc'd at the time the makefile is build (so presumably GLOBing won't work either). I don't want to hand-maintain a list of all moc files that will get generated by the build.