`GenerateExportHeader` and multi-compiler support

I have just started looking into GenerateExportHeader, but what I’ve noticed is that it does only generates the define for the specific compiler I am using, e.g. it does not have branching for __GNUC__, _MSC_VER. But then this is rather confusing, what is the purpose of this module?

Particularly I am looking at the DEPRECATED macro, which would not be usable in the exported header. EXPORT itself might be fine, but then how would you use it in a shared header file that is used both for the library compilation as well as exported for the library consumption where the EXPORT macro would not be defined?

Yes, that does seem to be a bit odd. I feel like it also simplifies the code as the preprocessor is far more flexible here than try_compile anyways. Could you please file an issue about this?

Issue open: https://gitlab.kitware.com/cmake/cmake/-/issues/25688