[CMake] compiling foo.c as a c++ file for visual studio projects

Brandon Van Every bvanevery at gmail.com
Fri Jun 15 12:53:09 EDT 2007


On 6/15/07, Jon W <knowdat at gmail.com> wrote:
> I'm using cmake to generate solutions for Visual Studio 2003.  With
> several of the projects I need to compile the *.c files as c++ code.
>
> I'm trying to get the /TP flag to override the /TC flag that is
> automatically generated by cmake, but not having much luck.

Is that due to flag order?

> I've read
> the mailing archive, and the only good workaround seemed to be
> renaming foo.c to FOO.C or foo.cpp.  The problem is that I have
> hundreds of files such as this from vendor libraries that I build, and
> it would be a continual task to rename files every time there is an
> update.

A CMake script could do that for you though.  "cmake -E" offers
portable commands for things like renaming.  I'm not saying this is a
great option, but it's not impossible.


Cheers,
Brnadon Van Every


More information about the CMake mailing list