I’ve been working on a C project that learns to also use C++ recently. I’ve up to now generated (as in file(GENERATE) a summary file with compilation options of certain targets, which used $<TARGET_PROPERTY:xyz,COMPILE_OPTIONS> generator expressions. This fails, once I use $<COMPILE_LANGUAGE:CXX> generator expressions to specify different sets of compile options for C or C++ on the same target, because CMake obviously doesn’t know in context of which language the generator expression shall be evaluated. Unfortunately there’s also no way I’m aware of, to manually specify this context. Is there a workaround to extract the compile options/definitions etc. for a specific language?
Here’s a small pastebin summary of the problem: https://pastebin.com/hBMUqJxv