# Is \`CMAKE\_ENABLE\_EXPORTS\` modified when \`WINDOWS\_EXPORT\_ALL\_SYMBOLS\` is set?

**URL:** <https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [April 14, 2022, 5:30pm UTC](https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470 "2022-04-14T17:30:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottB](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/e79b87/32.png) [@ScottB](https://discourse.cmake.org/u/ScottB)\
**Post date:** [April 14, 2022, 5:30pm UTC](https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470/1 "2022-04-14T17:30:12Z")

</div>

When compiling `Snappy v1.1.9` as a shared lib, I noticed the implementation library `snappy_test_support.lib` was absent.

The main library sets `WINDOWS_EXPORT_ALL_SYMBOLS` to `ON` [here](https://github.com/google/snappy/blob/1.1.9/CMakeLists.txt#L248-L250).

But a test support [lib](https://github.com/google/snappy/blob/1.1.9/CMakeLists.txt#L253) has no such modification.

I’ve observed that `snappy.dll`, `snappy.lib`, and `snappy_test_support.dll` are built without generating `snappy_test_support.lib`.

Grepping the code (including 3rd party) did not indicate to me that ENABLE\_EXPORTS was otherwise modified.

I couldn’t find any documentation to indicate setting `WINDOWS_EXPORT_ALL_SYMBOLS` would have a side effect. A brief perusal of the code was - for me - inconclusive.

Is the CMakeLists.txt file faulty or is there a defect elsewhere?

---

<div class="post-metadata">

**Author:** ![ScottB](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/e79b87/32.png) [@ScottB](https://discourse.cmake.org/u/ScottB)\
**Post date:** [April 14, 2022, 5:32pm UTC](https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470/2 "2022-04-14T17:32:16Z")

</div>

CMake v3.22.1 on Win64.

---

<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:** [April 14, 2022, 8:48pm UTC](https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470/3 "2022-04-14T20:48:14Z")

</div>

A missing `.lib` means that the library exports no symbols. `ENABLE_EXPORTS` is only defined to mean anything for executables, not libraries.

You can either add proper export macros on the support library’s declarations or use the same `WINDOWS_EXPORT_ALL_SYMBOLS` as the main library.

---

<div class="post-metadata">

**Author:** ![ScottB](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/e79b87/32.png) [@ScottB](https://discourse.cmake.org/u/ScottB)\
**Post date:** [April 15, 2022, 2:03pm UTC](https://discourse.cmake.org/t/is-cmake-enable-exports-modified-when-windows-export-all-symbols-is-set/5470/4 "2022-04-15T14:03:26Z")

</div>

Of course! Thanks for the quick response.
