0

I'm using visual studio 2013 with a compiler option /MP, which doesn't support precompiled headers. How do I set in CMakeLists.txt the "not using precompiled headers"?

EDIT: Resolved.

Mario made me thinking, and I checked again my cmakelists and it seems that I missed an include(./pch_support.cmake). Sorry, I didn't write this thing, and I only added to it the /MP (Multi-processor compilation), which, according to the MSDN doc might collide with other switches such as the precompiled header and create garbled output. Originally, I thought to disable the pch due to an annoying error which I got sometimes, which required a solution rebuild:

"error C1027: Inconsistent values for /Ym between creation and use of precompiled header"

But so far, it seems that adding the following lines to cmakelists helped:

string (REPLACE "/Zm1000" "/Zm200" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

(but I need more time to determine if it's really a solution, or I need to decide between pch and /MP.)

Zohar Levi
  • 614
  • 6
  • 16
  • What are the flags you're actually setting yourself? By default none of my CMake projects use precompiled headers and I never had to set anything by hand? – Mario Oct 12 '13 at 10:20
  • /MP is compatible with using precompiled headers. You just can't *create* one, /Yc option. – Hans Passant Oct 12 '13 at 10:37
  • I add precompiled headers to my cmake based projects using a macro (that uses /Yc) that is activated by a cmake option. Perhaps the OP can use this approach. A second approach would be to have cmake remove the /MP option however I would get rid of the precompiled headers before that. – drescherjm Oct 12 '13 at 12:24

0 Answers0