Skip to content

Libraries with NO_EXPORT option are exported as module libraries

If a library target asks to not be exported (i.e., dune_add_library(libname NO_EXPORT [...])) it gets excluded from the export set of the library (e.g. this line). That's the expected behavior.

However, the library name is still exported in the ${${ProjecName}_LIBRARIES} variable in the export file: set here and exported here. This is not correct as the library was not exported and consumers have no idea how to resolve such a library name. In particular, this fails when the consumer wants to enable all dune packages with dune_enable_all_packages, dune_target_enable_all_packages or directly linking to the dependent libraries.

The correct behavior is incidentally fixed in !1247 (merged) by having internal and external library modules: ${${ProjecName}_INTERFACE_LIBRARIES} is set here and exported here, where this variable is only set for exported module libraries.

Edit: Link to the export set is updated to the correct line.

Edited by Santiago Ospina De Los Ríos