.. _dune_add_pybind11_module:

dune_add_pybind11_module
========================

.. cmake_function:: dune_add_pybind11_module

   .. cmake_param:: NAME
      :required:
      :single:

      name of the Python module

   .. cmake_param:: SOURCES
      :multi:

      source files to build shared library

      If this parameter is omitted, <name>.cc will be used if it exists.

   .. cmake_param:: EXCLUDE_FROM_ALL
      :option:

      exclude this module from the all target

   .. cmake_param:: COMPILE_DEFINITIONS
      :multi:
      :argname: def

      A set of compile definitions to add to the target.
      Only definitions beyond the application of :ref:`add_dune_all_flags`
      have to be stated.

   .. cmake_param:: CMAKE_GUARD
      :multi:
      :argname: condition

      A number of conditions that CMake should evaluate before adding this
      module. Use this feature instead of guarding the call to
      :code:`dune_add_pybind11_module` with an :code:`if` clause.

      The passed condition can be a complex expression like
      `( A OR B ) AND ( C OR D )`. Mind the spaces around the parentheses.

      Example: Write CMAKE_GUARD dune-foo_FOUND if you want your module to only
      build when the dune-foo module is present.

