Hi!<div><br></div><div>I have built a simple system to get precompiled header support in visual c++.</div><div>The mechanism behind this functionality is adding the command line flags when compiling every source file. /Yu to specify a header file that should be precompiled and what /Fp as name for the actually generated precompiled header file.</div>
<div><br></div><div>I use CMAKE_CXX_FLAGS to set this property:</div><div>set (CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} /Yu${pchbase}.h /Fp$(IntDir)/$(TargetName).pch /D \&quot;USE_PRECOMPILED\&quot;&quot; )<br></div><div>
<br></div><div>Now I added a c (as opposed to c++) file to my project and this c file is not compatible with precompiled headers and the compilation fails.</div><div><br></div><div>First, should really CMAKE_CXX_FLAGS affect targets suffixed .c at all? Shouldn&#39;t it be only for c++ files like suffixed .cpp or .cxx?</div>
<div><br></div><div>Since it does affect my C file, is there a way of actively remove flags for a specific file?</div><div><div><br></div><div>For this particular case I can&#39;t rename my c file to cpp and compile it in c++ mode since the actual reason I want the file to be compiled is to make sure that some header files doesn&#39;t contain anything c++ specific.</div>
<div><br></div><div>/David</div><div><br></div></div>