[CMake] CMake and it's invocation from MS VC7

Brad King brad.king at kitware.com
Wed May 17 14:27:26 EDT 2006


Steve Johns wrote:
>> Once it is implemented properly you could do something like
>>
>> SET(NRC206_SRCS ADDINT.C ...)
>> SET_SOURCE_FILES_PROPERTIES(${NRC206_SRCS} PROPERTIES COMPILE_LANGUAGE C)
>> ADD_LIBRARY(NRC206 ${NRC206_SRCS})
>>
>> to override the default choice of compile language for capital ".C" 
>> extensions.  I'm not sure when we'll get to this.
> 
> 
> At this point, with the new CMake 2.4.2 successfully treating  "foo.c" 
> as a C file, I have an opposite need to compile certain C files as C++.
> IOW, I need to apply " /TP " to certain specific files like "FOO.C" (or 
> foo.c).
> 
> Can I arrange this, either with the sytax above, or some other way, 
> using CMake 2.4.2 ?

This would require the COMPILE_LANGUAGE property I mentioned to do 
directly.  We'll probably implement this soon but it is not in 2.4.2.

Can't you just rename the file to have a C++ extension?  If not, you can 
get "foo.c" compiled as C++ by creating an extra file called "foo.cxx" 
and adding it instead.  The file would contain just the code

// foo.cxx
#include "foo.c"

-Brad


More information about the CMake mailing list