Hi!
I have built a simple system to get precompiled header support in visual
c++.
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.

I use CMAKE_CXX_FLAGS to set this property:
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Yu${pchbase}.h
/Fp$(IntDir)/$(TargetName).pch /D \"USE_PRECOMPILED\"" )

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.

First, should really CMAKE_CXX_FLAGS affect targets suffixed .c at all?
Shouldn't it be only for c++ files like suffixed .cpp or .cxx?

Since it does affect my C file, is there a way of actively remove flags for
a specific file?

For this particular case I can'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't contain anything c++ specific.

/David
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to