Hi. I have stumbled upon an use case where I think this might come handy, but I am not sure if possible in current CMake.
My project specifies a target A which depends on targets B & C. For third party integration, I instruct users to specify the needed include, library paths and definitions.
This day I got bitten by not specifying all definitions which created an API/ABI inconsistency (Compiled A target used different struct size than the users integration).
To combat this, I was thinking of using INTERFACE_COMPILE_DEFINITIONS to query needed public defines for target A (and its dependencies), which I could then install as a
config.h header or something similar for users to not require setting a list of defines manually.
Unfortunately the following property does not extend to dependencies. If either B or C targets add or remove certain configuration define then those aren’t reflected in A target property.
Is there a way to transitively get all PUBLIC and INTERFACE definitions of a certain target, which could then be “exported” to a config header file for consumption by a third party library integration?
Or better yet is there a preferred way of making your project/library easier to ingest by third party integrations?