Why do I need the PUBLIC keyword in target_sources ()?
1 answer
Official documentation does not help? Public implementation files will be added to the INTERFACE_SOURCES
variable for this purpose. Later, when importing this target, this variable can be used to extract implementation files. From the documentation above it can be seen that such extraction is typical for target_link_libraries
, i.e. this information is used by her to “embed” dependencies.
Personally, I have not seen such use, and I don’t see much sense in it. If you need to export your code, it is better to create a library.
|