Skip to content

Deprecate the MODULE_LIBRARIES argument to dune_enable_all_packages

Summary

This MR tries to resolve the issue #387, not by fixing the function dune_enable_all_packages(MODULE_LIBRARIES <lib>) but instead by providing a cleaner alternative and by deprecating this MODULE_LIBRARIES argument.

Instead of dune_enable_all_packages(MODULE_LIBRARIES <lib>) write the following

dune_add_library(<lib> [INTERFACE] EXPORT_NAME <Lib> [...]) # with more parameter to configure the export
target_sources(<lib> ...)                                   # Add sources to the target if needed
dune_target_enable_all_packages(<lib> [INTERFACE])          # Add all flags to the target if needed
link_libraries(<lib>)                                       # Link all other targets against <lib>

There is no easy way to fix the dune_enable_all_packages directly. Exporting a library might require multiple extra parameters and it is much easier to just do this in 3-4 lines explicitly instead of relying on hidden behavior in the dune_enable_all_packages function.

This MR also deprecates the cmake function dune_library_add_sources(<lib> SOURCES ...) since it can be directly replaced by target_sources(<lib> PRIVATE ...).

Closes #387

Edited by Simon Praetorius

Merge request reports

Loading