Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-04-08 06:48:20


Hi Craig,
> Hi,
>
> I am working with a legacy codebase and would like to compile
> it with jam. For some bone-headed reason, my codebase
> has a lot of C++ files which end with ".c" instead of ".cpp" or ".cc".
>
> Ideally I would like to change these file extensions, but
> because this is a large codebase compiled on different platforms,
> I may not be able to do this easily.
>
> I notice in gcc.jam, there is a line:
>
> generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
>
> Is there a way to override this so that it invokes
> g++ also, for files ending in .c?

Not that I know any easy way.

> Sorry for this question, but my legacy codebase has a lot of
> silly things in it. :(

Hmm.. I'd suggest this trick:

project your_project : requirements <toolset>gcc:<cflags>"-x c++" ;

This will produce command lines like:

gcc.compile.c bin/gcc/debug/a.o

"g++" -x c -Wall -O0 -fno-inline -g -x c++ .....

And the second "-x" option will override the first one.

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk