# Problem with target\_precompile\_headers

**URL:** https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724
**Category:** Code
**Tags:** os:windows, comp:msvc
**Created:** [February 9, 2021, 3:16am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724 "2021-02-09T03:16:40Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![WOFST](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wofst/32/1189_2.png) [@WOFST](https://discourse.cmake.org/u/WOFST)
#### Post date: [February 9, 2021, 3:16am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/1 "2021-02-09T03:16:40Z")

</div>

I use the target\_precompile\_headers( REUSE\_FROM \<other\_target\>) for a Qt project,but happend a LINK200 failed,and my environment is：

- visual studio 2017
- Qt 5.14.0(5.6.0 or 5.9.4 is also a failure)
- CMAKE 3.18.5(3.19 or 3.17 is also a failure)

git: [https://github.com/WOFST/PrecompileDemo.git](https://github.com/WOFST/PrecompileDemo.git)

---

<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: [February 9, 2021, 8:43pm UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/2 "2021-02-09T20:43:59Z")

</div>

Likely already a known issue with a potential fix, but CC’ing @cristianadam just in case.

---

<div class="post-metadata">

### Author: ![WOFST](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wofst/32/1189_2.png) [@WOFST](https://discourse.cmake.org/u/WOFST)
#### Post date: [February 10, 2021, 9:45am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/3 "2021-02-10T09:45:44Z")

</div>

That’s great, which version fixes it

---

<div class="post-metadata">

### Author: ![WOFST](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wofst/32/1189_2.png) [@WOFST](https://discourse.cmake.org/u/WOFST)
#### Post date: [February 10, 2021, 9:46am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/4 "2021-02-10T09:46:25Z")

</div>

I tried 3.19.4 as if I had failed

---

<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: [February 10, 2021, 12:42pm UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/5 "2021-02-10T12:42:41Z")

</div>

Probably in the upcoming 3.19.5 if it has been fixed already.

---

<div class="post-metadata">

### Author: ![cristianadam](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cristianadam/32/124_2.png) [@cristianadam](https://discourse.cmake.org/u/cristianadam)
#### Post date: [February 10, 2021, 2:10pm UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/6 "2021-02-10T14:10:13Z")

</div>

I fixed a problem with MSVC and `REUSE_FROM` signature from `target_precompile_headers` in CMake 3.20. See [issue 20201](https://gitlab.kitware.com/cmake/cmake/-/issues/20201).

---

<div class="post-metadata">

### Author: ![WOFST](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wofst/32/1189_2.png) [@WOFST](https://discourse.cmake.org/u/WOFST)
#### Post date: [February 10, 2021, 2:30pm UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/7 "2021-02-10T14:30:06Z")

</div>

Well, thank you.

---

<div class="post-metadata">

### Author: ![WOFST](https://discourse.cmake.org/user_avatar/discourse.cmake.org/wofst/32/1189_2.png) [@WOFST](https://discourse.cmake.org/u/WOFST)
#### Post date: [February 17, 2021, 2:30am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/8 "2021-02-17T02:30:37Z")

</div>

I tried and failed with 3.20. 0 - rc1 and The reason is that the Qt moc definition of the REUSE\_FROM library could not be found

---

<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: [February 17, 2021, 8:19am UTC](https://discourse.cmake.org/t/problem-with-target-precompile-headers/2724/9 "2021-02-17T08:19:40Z")

</div>

That could be related to the problem I [reported](https://gitlab.kitware.com/cmake/cmake/-/issues/21823) earlier today, but hard to say.
