[cmake-developers] A type for static plugins?
Stephen Kelly
steveire at gmail.com
Fri Sep 20 08:14:20 EDT 2013
Hello,
In CMake, the MODULE_LIBRARY type is quite like a shared library which is
not linked to. In Qt, there is a concept of a static plugin. This is
essentially just a static library, but there is buildsystem awareness of the
difference.
When building a static library using Qt, the QT_STATICPLUGIN preprocessor
macro must be defined:
http://doc-snapshot.qt-project.org/qt5-stable/qtcore/plugins-howto.html#static-plugins
This affects the compilation of moc generated files (In Qt 5 plugin
information is generated by moc).
If CMake had a STATIC_MODULE library type, I would be able to add:
$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_MODULE>:QT_STATICPLUGIN>
to the INTERFACE_COMPILE_DEFINITIONS of Qt5::Core, and all consumers wishing
to create a static library would use
add_library(mystatic_library STATIC_MODULE foo.cpp)
target_link_libraries(mystatic_library Qt5::Core)
and automatically get the correct definition set.
Any comments on adding a new STATIC_MODULE type to CMake?
Thanks,
Steve.
More information about the cmake-developers
mailing list