# /MP on all files but pre\_compiled\_header

**URL:** https://discourse.cmake.org/t/mp-on-all-files-but-pre-compiled-header/1781
**Category:** Usage
**Tags:** comp:msvc, gen:vs, os:windows
**Created:** [September 3, 2020, 8:03pm UTC](https://discourse.cmake.org/t/mp-on-all-files-but-pre-compiled-header/1781 "2020-09-03T20:03:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sandercox](https://discourse.cmake.org/user_avatar/discourse.cmake.org/sandercox/32/812_2.png) [@sandercox](https://discourse.cmake.org/u/sandercox)
#### Post date: [September 3, 2020, 8:03pm UTC](https://discourse.cmake.org/t/mp-on-all-files-but-pre-compiled-header/1781/1 "2020-09-03T20:03:26Z")

</div>

We have switched to using `target_precompile_headers()` and since we did this we’ve been getting the following warning in MSBuild based builds:

> cl : command line warning D9030: ‘/Yc’ is incompatible with multiprocessing; ignoring /MP switch

our main cmake script contains  
if(MSVC)  
set(CMAKE\_CXX\_FLAGS “${CMAKE\_CXX\_FLAGS} /MP”)  
endif()

So the “/MP” is added on purpose - as it’s absolutely impossible to build without it (large code base and we have high-end workstations with minimum 18-cores - parallelbuild is essential for a realistic build-time).

I’d like to disable the /MP on my precompiled header to get rid of this warning (we don’t like warnings).

My first attempt was to just ignore it with /wd9030 but that didn’t work as this is not a compiler warning but a compiler invocation warning no idea how to disable those.

Would there be a way to fix the precompiled header files CXX\_FLAGS?

---

<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: [September 8, 2020, 3:59pm UTC](https://discourse.cmake.org/t/mp-on-all-files-but-pre-compiled-header/1781/2 "2020-09-08T15:59:16Z")

</div>

Try adding:

```cmake
if(MSVC)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
    list(APPEND CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH /wd9030)
endif()

```
