# External Include on MSVC

**URL:** <https://discourse.cmake.org/t/external-include-on-msvc/3824>\
**Category:** Code\
**Created:** [July 23, 2021, 3:37pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824 "2021-07-23T15:37:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leon0402](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ccd318/32.png) [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Post date:** [July 23, 2021, 3:37pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824/1 "2021-07-23T15:37:39Z")

</div>

Hi,

I found that cmake seems to support `-external:I` since [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/4766](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4766).

I have something something like this in my project:

```auto
get_property(date_include_dirs TARGET date PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
set_property(TARGET date PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${date_include_dirs}")

```

To make third party libs via fetch Content System Includes.

On MSVC this still leads to:

```auto
/I"C:\Users\LeonD\Documents\beans\build-v
         s16\_deps\date-src\include"

```

while on CLang / GCC it correctly leads to:

```auto
-isystem /home/leon/Projects/beans/build/_deps/date-src/include

```

Why is it not using `-external:I` on MSVC? Isn’t this what above mentioned Merge Request did implement or do I miss something?

---

<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:** [July 23, 2021, 3:48pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824/2 "2021-07-23T15:48:39Z")

</div>

Are you using a new enough MSVC compiler? It is only enabled for a toolchain that was released a few months ago.

---

<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:** [July 23, 2021, 3:51pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824/3 "2021-07-23T15:51:34Z")

</div>

Additionally, it is only supported with the `Makefiles` and `Ninja` generator as Visual Studio generation seems quite a bit more involved and I didn’t have the time to do that as well.

---

<div class="post-metadata">

**Author:** ![Leon0402](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/ccd318/32.png) [@Leon0402](https://discourse.cmake.org/u/Leon0402)\
**Post date:** [July 23, 2021, 5:43pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824/4 "2021-07-23T17:43:22Z")

</div>

Oh yes it’s with the Visual Studio Generator. Is there any workaround?

---

<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:** [July 23, 2021, 5:49pm UTC](https://discourse.cmake.org/t/external-include-on-msvc/3824/5 "2021-07-23T17:49:02Z")

</div>

No, the XML elements that are needed in the `.vcxproj` need to be generated at the right place and that code has not yet been written.
