Wrapping: Get preprocessor flags from CMake generator
Currently we explicitly construct a list of include directories and
compile definitions to pass to the wrapping parsers from module
variables. With CMake 3.1 and above we can use file(GENERATE)
and the
$<TARGET_PROPERTY:...>
generator expression to get the
INCLUDE_DIRECTORIES
and COMPILE_DEFINITIONS
of the wrapped module
library at generate time from CMake. This can actually be done in a few
earlier versions of CMake too but we need 3.1 to have a generator
expression in the add_custom_command
DEPENDS
option.
This approach avoids use of manually constructed lists of preprocessor flags and always ensures that the wrapping parsers get the same preprocessor flags as the compiler will get when compiling the module library. It will also allow us to get preprocessor flags through CMake usage requirements (e.g. target_include_directories and target_compile_definitions) for third-party system libraries.