DuneAddLibrary -------------- Add a library to a Dune module. .. cmake:command:: dune_add_library Create a new library target. There are three different interfaces following the standard CMake signatures. .. code-block:: cmake dune_add_library( [STATIC|SHARED|MODULE] [SOURCES ] [LINK_LIBRARIES ...] [COMPILE_OPTIONS ";..."] [OUTPUT_NAME ] [EXPORT_NAME ] [NAMESPACE ] [NO_EXPORT] [NO_MODULE_LIBRARY] ) Create a new library target with ```` for the library name. On Unix this creates ``lib.so`` or ``lib.a``. The target properties are automatically filled with the given optional arguments. A dune library is exported into a unique export set if the parameter ``NO_EXPORT`` is not given. This export set is automatically installed and exported in the :cmake:command:`finalize_dune_project()` function. ``SOURCES`` The source files from which to build the library. ``LINK_LIBRARIES`` (or ``ADD_LIBS``) A list of libraries the target is explicitly linked against. .. versionchanged:: 2.9 The parameter ``ADD_LIBS`` is deprecated. ``COMPILE_OPTIONS`` (or ``COMPILE_FLAGS``) Additional compile flags for building the library. .. versionchanged:: 2.9 The parameter ``COMPILE_FLAGS`` is deprecated. ``OUTPUT_NAME`` Name of the created library file, e.g. ``lib.so`` or ``lib.a``. ``NAMESPACE`` Name to be prepended to the export name of the target. By default this is set to ``Dune::``. ``EXPORT_NAME`` Name of the exported target to be used when linking against the library. The name is prepended with the given namespace. ``NO_EXPORT`` If omitted the library is exported for usage in other modules. ``NO_MODULE_LIBRARY`` If omitted the library is added to the global property ``_LIBRARIES``. If ``NO_EXPORT`` is omitted, the library is also added to the global property ``_EXPORTED_LIBRARIES``. .. versionadded:: 2.9 .. code-block:: cmake dune_add_library( INTERFACE [LINK_LIBRARIES ...] [COMPILE_OPTIONS ";..."] [EXPORT_NAME ] [NAMESPACE ] [NO_EXPORT] [NO_MODULE_LIBRARY] ) Create an interface library target with ```` for the library name. An interface target does not contain any sources but may contain flags and dependencies. A dune library is exported into a unique export set if the parameter ``NO_EXPORT`` is not given. This export set is automatically installed and exported in the :cmake:command:`finalize_dune_project()` function. ``LINK_LIBRARIES`` (or ``ADD_LIBS``) A list of libraries the target is explicitly linked against. .. versionchanged:: 2.9 The parameter ``ADD_LIBS`` is deprecated. ``COMPILE_OPTIONS`` (or ``COMPILE_FLAGS``) Additional compile flags for building the library. .. versionchanged:: 2.9 The parameter ``COMPILE_FLAGS`` is deprecated. ``NAMESPACE`` Name to be prepended to the export name of the target. By default this is set to ``Dune::``. ``EXPORT_NAME`` Name of the exported target to be used when linking against the library. The name is prepended with the given namespace. ``NO_EXPORT`` If omitted the library is exported for usage in other modules. ``NO_MODULE_LIBRARY`` If omitted the library is added to the global property ``_LIBRARIES``. .. deprecated:: 2.9 .. code-block:: cmake dune_add_library( OBJECT [SOURCES ] [LINK_LIBRARIES ...] [COMPILE_OPTIONS ";..."] ) Create an object library target ```` to collect multiple sources to be added to a library target later. This utility is deprecated. Create a regular library target in a parent scope and add the sources directly using ``target_sources( PRIVATE ...)`` instead. ``SOURCES`` The source files from which to build the library. ``LINK_LIBRARIES`` A list of libraries the target is explicitly linked against. ``COMPILE_OPTIONS`` Additional compile flags for building the library.