My goal is simple. When I consume a given library header through:
find_package(<package>)
target_link_libraries(<target> [Inheritance] <package>)
I would like to treat <package>
header as system or not system regardless of how it has been actually packaged.
Besides, when using several packages, I may have different settings, according to the package.
Eventually, I’d like my own libraries (to be imported) being not system by default.
Yet I’m confused by CMake documentation that propose several mechanisms, some of them being deprecated:
- NO_SYSTEM_FROM_IMPORTED, which seems to be a global option for the target/consumer
- IMPORTED_NO_SYSTEM (marked as deprecated), which was supposed to set the behavior per imported target/package
- SYSTEM, which is an option that is set by the “to be consumed/imported” target
- EXPORT_NO_SYSTEM that I don’t really understand.
Would it be possible to have an example (or a link to) of how to answer my need?
Where can I find clarifications on the different mechanisms usage?
How do they interact (for instance, if a library has been packaged as system but the client wants to included its headers as non system, or the other way around)?
Thanks in advance,
A.
how do they interact?