[Scons-users] .C suffix for c files on POSIX

Carl Cerecke carl.cerecke at compacsort.com
Sun Jan 5 17:43:13 EST 2014


On 20 December 2013 11:37, Dirk Bächle <tshortik at gmx.de> wrote:

> On 19.12.2013 23:17, Carl Cerecke wrote:

>>

>> On 19 December 2013 14:46, Dirk Bächle <tshortik at gmx.de> wrote:

>>>

>>> Hi Carl,

>>>

>>>

>>> On 19.12.2013 00:49, Carl Cerecke wrote:

>>>>

>>>> How can I tell scons that a .C suffix is for C files, not C++ files on

>>>> Linux?

>>>>

>>>> I've tried env.Append(CFILESUFFIX=['.C']) but it does not work - the

>>>> files are still recognised as C++.

>>>

>>>

>>> I think that instead of restricting the suffix list, it'd be easier to

>>> create an Environment that only loads the C compiler:

>>>

>>> ccenv = Environment(tools=['cc','link','ar'])

>>>

>>> and use that one to compile your sources.

>>

>> Thanks, Dirk. Good idea. Except the program is a mix of C and C++.

>>

>

> Then compile the C files with "ccenv" and the C++ files with your "standard"

> environment...note that you can freely mix and use an arbitrary number of

> environments, with differently intialized tools and variable/path settings,

> within your SConstructs/SConscripts.


Thanks. This works with a bit of fiddling around, including:

ccenv.Append(CCFLAGS='-x c')

gcc sees the .C and assumes C++. The -x c forces c.

(No, I haven't been struggling to do this for two weeks and only just
figured it out. I've been on holiday... it's summer here)

Carl.


More information about the Scons-users mailing list