DuneEnableAllPackages

Commands for simplified package flag handling in the DUNE build system.

dune_enable_all_packages

Register all discovered package flags and libraries for subsequent targets in the current directory scope and its subdirectories.

dune_enable_all_packages(
  [INCLUDE_DIRS <dirs...>]
  [COMPILE_DEFINITIONS <defs...>]
  [COMPILE_OPTIONS <opts...>]
  [MODULE_LIBRARIES <libs...>]
  [VERBOSE]
  [APPEND]
)

This command provides a simplified mode in which all collected external package flags are applied automatically to targets created later in the module.

INCLUDE_DIRS

Additional include directories added to all subsequent targets.

COMPILE_DEFINITIONS

Additional compile definitions added to all subsequent targets.

COMPILE_OPTIONS

Additional non-definition compile options added to all subsequent targets.

MODULE_LIBRARIES

Libraries from the current module that should participate in the automatic linking setup. If programs in the module should link to those libraries automatically, they must be listed here.

VERBOSE

Print the resulting compile flags, linked libraries, and include directories during configuration.

APPEND

Append the provided flags to the global collection instead of prepending them.

If used, this command must be called in the top-level CMakeLists.txt before adding subdirectories. For modern module libraries, prefer dune_add_library() and explicit target properties when possible.

dune_target_enable_all_packages

Add all currently registered package flags to specific targets.

dune_target_enable_all_packages(TARGETS <targets...>)
TARGETS

The targets receiving the currently registered package flags.

The added flags use PUBLIC scope for compiled libraries and INTERFACE scope otherwise.

dune_register_package_flags

Register package-specific include paths, compile flags, and link libraries.

dune_register_package_flags(
  [INCLUDE_DIRS <dirs...>]
  [COMPILE_DEFINITIONS <defs...>]
  [COMPILE_OPTIONS <opts...>]
  [LIBRARIES <libs...>]
  [APPEND]
)
INCLUDE_DIRS

Include directories required by the external package.

COMPILE_DEFINITIONS

Compile definitions required by the external package.

COMPILE_OPTIONS

Compile options required by the external package.

LIBRARIES

Libraries that should be linked for the external package. The order of the input is preserved.

APPEND

Append the specified values to the global collection instead of prepending them.

This command is primarily intended for custom FindFoo modules or for integrating external find modules that cannot be modified directly.

dune_library_add_sources

Register sources for a module library created through the automatic package handling workflow.

dune_library_add_sources(<module_library> SOURCES <sources...>)
module_library

The name of the module library target.

SOURCES

Source files added to the DUNE module library module_library.

The target must have been created earlier by dune_enable_all_packages() in the current module.