[cmake-developers] A type for static plugins?

Brad King brad.king at kitware.com
Fri Sep 20 13:47:19 EDT 2013


On 09/20/2013 01:40 PM, Stephen Kelly wrote:
> macro(qt_add_plugin name type)
>   if (${type} STREQUAL STATIC OR ${type} STREQUAL MODULE)
>     set(_type ${type})
>     set(args ${ARGN})
>   else()
>     set(_type MODULE)
>     set(args ${type} ${ARGN}) 
>   endif()
>   add_library(${name} ${_type} ${ARGN})

s/ARGN/args/ ?

>   if (_type STREQUAL STATIC)
>     set_target_properties(${name} PROPERTIES
>       PLUGIN "1" 
>       # Not sure if this is a Qt/KDE convention:
>       PREFIX ""
>     )
>   endif()
> endmacro()

Don't you want an empty prefix for MODULE too?

> A remaining question is whether the 'PLUGIN' target property should be a 
> CMake built-in target property or a QT_ prefixed one?

It is added and used by Qt infrastructure, so QT_ is appropriate.
That will stay out of the way of possible future CMake builtin
support.  Also, can't QT_PLUGIN just be set on the target to
indicate it is a plugin, whether it is STATIC or MODULE?  Then
generator expressions can do the right thing based on both the
target type and the presence of the QT_PLUGIN property.

-Brad



More information about the cmake-developers mailing list