On 26.08.2012 18:16, Thiago Macieira wrote: > On domingo, 26 de agosto de 2012 17.31.07, Peter Kümmel wrote: >> When building plugins, moc generates files with '#ifdef QT_NO_DEBUG' >> but the lib/cmake modules doesn't add QT_NO_DEBUG for release builds. >> A bug? > > What are you talking about?
A bug in Qt5CoreMacros.cmake: http://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/Qt5CoreMacros.cmake#line216 moc generates this plugin code: #ifdef QT_NO_DEBUG QT_PLUGIN_METADATA_SECTION static const unsigned char qt_pluginMetaData[] = { ... }; #else // QT_NO_DEBUG QT_PLUGIN_METADATA_SECTION static const unsigned char qt_pluginMetaData[] = { ... }; #endif // QT_NO_DEBUG Therefore also QT_NO_DEBUG must be defined for a release build, if not then the plugin could not be loaded (at least on Windows) because the plugin meta info says the the plugin is a debug build. When 'qt5_use_modules _target' is used, QT_NO_DEBUG is not set even if 'qt5_use_modules _target' adds other defines: set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) A workaround is to define QT_NO_DEBUG in the project which uses Qt5 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG") but I think QT_NO_DEBUG should be already set by the cmake code shipped with Qt. Peter > > The moc program is the same, regardless of your buildsystem. CMake runs it to > generate code, even if the automoc functionality is enabled. So the code > generation is the same. > > > > > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
