# FetchContent and Compiler launcher

**URL:** https://discourse.cmake.org/t/fetchcontent-and-compiler-launcher/9202
**Category:** Code
**Created:** [October 15, 2023, 9:16am UTC](https://discourse.cmake.org/t/fetchcontent-and-compiler-launcher/9202 "2023-10-15T09:16:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![silverqx](https://discourse.cmake.org/user_avatar/discourse.cmake.org/silverqx/32/2353_2.png) [@silverqx](https://discourse.cmake.org/u/silverqx)
#### Post date: [October 15, 2023, 9:16am UTC](https://discourse.cmake.org/t/fetchcontent-and-compiler-launcher/9202/1 "2023-10-15T09:16:49Z")

</div>

I want to know if the FetchContent and ExternalProject consider the `CMAKE_CXX_COMPILER_LAUNCHER=ccache`. Thx

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [October 15, 2023, 8:58pm UTC](https://discourse.cmake.org/t/fetchcontent-and-compiler-launcher/9202/2 "2023-10-15T20:58:32Z")

</div>

FetchContent brings things directly into the main build, so whatever you set up for the compiler will also apply to the dependencies brought in this way. In other words, `CMAKE_CXX_COMPILER_LAUNCHER` will also apply to the dependency (unless it has its own logic that overrides it).

ExternalProject sets up a separate child build, and from what I recall, it won’t propagate `CMAKE_CXX_COMPILER_LAUNCHER` to that sub-build. In general, it isn’t guaranteed to be safe for it to propagate that setting, because the external project could be using an entirely different toolchain, one which might not work with the launcher.

---

<div class="post-metadata">

### Author: ![silverqx](https://discourse.cmake.org/user_avatar/discourse.cmake.org/silverqx/32/2353_2.png) [@silverqx](https://discourse.cmake.org/u/silverqx)
#### Post date: [October 16, 2023, 7:34am UTC](https://discourse.cmake.org/t/fetchcontent-and-compiler-launcher/9202/3 "2023-10-16T07:34:14Z")

</div>

Thx for reply, it makes sense
