BasicPlugin

include(BasicPlugin)

Supplies a function for building cetlib compatible plugin libraries. Note that this provides a slightly different API from the cetbuildtools version to decouple the build/install steps and to remove UPS specifics.

The following function for building plugin libraries is defined

basic_plugin
basic_plugin(<name>
             <plugintype>
             [[NOP] <libraries>]
             [USE_BOOST_UNIT]
             [ALLOW_UNDERSCORES]
             [BASENAME_ONLY]
             [USE_PRODUCT_NAME]
             [SOURCE <sources>])

The plugin library’s name is constructed from the specified <name>, <plugintype> (eg service, module, source), and (unless BASENAME_ONLY is specified) the package subdirectory path (replacing “/” with “_”). The plugin type is expected to be service, source, or module, but this is not enforced.

Options:

ALLOW_UNDERSCORES
Allow underscores in subdirectory names. Discouraged, as it creates a possible ambiguity in the encoded plugin library name (e.g. foo_bar/baz is indistinguishable from foo/bar/baz).
BASENAME_ONLY
Omit the subdirectory path from the library name. Discouraged, as it creates an ambiguity between modules with the same source filename in different packages or different subdirectories within the same package. The latter case is not possible however, because CMake will throw an error because the two CMake targets will have the same name and that is not permitted. Mutually exclusive with USE_PRODUCT_NAME.
NOP
Dummy option for the purpose of separating (say) multi-option arguments from non-option arguments.
SOURCE
If specified, the provided sources will be used to create the library. Otherwise, the generated name <name>_<plugin_type>.cc will be used and this will be expected to be found in the current CMake source directory (CMAKE_CURRENT_SOURCE_DIR).
USE_BOOST_UNIT
Build the plugin to allow its use in Boost.Unit tests
USE_PRODUCT_NAME
Prepend the product name (value of PROJECT_NAME in non-UPS) to the plugin library name. Mutually exclusive with BASENAME_ONLY.

Todo

It is likely that this module should be promoted to cetlib because the major functionality of the module is to enforce the cetlib plugin naming convention. If this convention changes, then it is most clearly communicated via changes to the cetlib API. Otherwise, all this module does is to use add_library/target_link_libraries that any user would be comfortable with.