[cmake-developers] A type for static plugins?
Brad King
brad.king at kitware.com
Fri Sep 20 13:22:36 EDT 2013
On 09/20/2013 12:03 PM, Stephen Kelly wrote:
> if (my_lib_type STREQUAL SHARED)
> add_library(some_plugin MODULE main.cpp)
> else()
> add_library(some_plugin STATIC
> SOURCES main.cpp
> PROPERTIES
> STATICPLUGIN 1
> # If we need this anyway, we might as well move it upscope
> # and remove the CMAKE_SHARED_MODULE_PREFIX setting, replacing
> # it with
> # set_property(TARGET some_plugin PROPERTY PREFIX "")
> PREFIX ""
> )
> endif()
That has to duplicate the list of sources, and the properties make
the add_library call start to look pretty verbose anyways.
Currently we can just do:
set(plugin_type ...) # MODULE or STATIC
add_library(some_plugin ${plugin_type} main.cpp)
set_target_properties(some_plugin PROPERTIES PLUGIN "1" PREFIX "")
Can't this be packaged up in a qt_add_plugin() API?
> seems another gain from adding a STATIC_MODULE type would be control of
> things like the default PREFIX
Yes, but everything is already possible to achieve without a new
target type, and a new type will add a lot of complexity.
-Brad
More information about the cmake-developers
mailing list