Allow to query meta-fields used when compiling / linking
Compilation is controlled by referencing some fields that are generated from various sources. For example:
<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>.
what I would like to propose is a function (and possibly generator expression) that allows to query those values just as cmake would do during compilation(/linking).
This relevant if you for example need the used include paths, in my specific example I tried to use the new
doxygen_add_docs function, but I failed to be able to fetch the include paths from the used libraries.
It would be possible to read the
INTERFACE_INCLUDE_DIRECTORIES for all linked libraries... but those could be complex generator expressions (eq. BUILD_INTERFACE/INSTALL_INTERFACE) that cant be directly used.
For such use-cases a function like
query_target_metafield(VARNAME TARGET FIELD) would be really practical, it could extract this information directly like CMake does when compiling/linking (now ignoring that some sourcefiles could possibly add properties). Quite possible the function would need an argument to specify language, but there should be automatisms to use the target language when missing (same way the language for linking is deduced) - this should cover most usecases.