# \`GenerateExportHeader\` and multi-compiler support

**URL:** https://discourse.cmake.org/t/generateexportheader-and-multi-compiler-support/10102
**Category:** Code
**Created:** [February 15, 2024, 1:47pm UTC](https://discourse.cmake.org/t/generateexportheader-and-multi-compiler-support/10102 "2024-02-15T13:47:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lecris](https://discourse.cmake.org/user_avatar/discourse.cmake.org/lecris/32/3193_2.png) [@Lecris](https://discourse.cmake.org/u/Lecris)
#### Post date: [February 15, 2024, 1:47pm UTC](https://discourse.cmake.org/t/generateexportheader-and-multi-compiler-support/10102/1 "2024-02-15T13:47:02Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 18, 2024, 3:24am UTC](https://discourse.cmake.org/t/generateexportheader-and-multi-compiler-support/10102/2 "2024-02-18T03:24:33Z")

</div>

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](https://gitlab.kitware.com/cmake/cmake/-/issues) about this?

---

<div class="post-metadata">

### Author: ![Lecris](https://discourse.cmake.org/user_avatar/discourse.cmake.org/lecris/32/3193_2.png) [@Lecris](https://discourse.cmake.org/u/Lecris)
#### Post date: [February 18, 2024, 10:22pm UTC](https://discourse.cmake.org/t/generateexportheader-and-multi-compiler-support/10102/4 "2024-02-18T22:22:14Z")

</div>

Issue open: [https://gitlab.kitware.com/cmake/cmake/-/issues/25688](https://gitlab.kitware.com/cmake/cmake/-/issues/25688)
