<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [CMake] -DCMAKE_C_COMPILER:string="g++"</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Note that many C/C++ compilers rely on the file extension to determine whether it should be processed using C or C++.<BR>
<BR>
I tested this a file with a simple function and with the following extensions on linux 32 bit and looked at the symbols using nm.<BR>
<BR>
For "gcc -c"<BR>
.c unmangled<BR>
.C mangled<BR>
.cc mangled<BR>
<BR>
For "g++ -c"<BR>
.c mangled<BR>
.C mangled<BR>
.cc mangled<BR>
<BR>
I don't have the intel compiler handy, but I think I remember it uses the same binary for C and C++ compilation and relies very much on the file extension.<BR>
<BR>
Regards,<BR>
<BR>
Juan<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: cmake-bounces+juan.sanchez=amd.com@cmake.org on behalf of Bill Hoffman<BR>
Sent: Wed 8/8/2007 8:52 PM<BR>
To: Marie-Christine Vallet; cmake<BR>
Subject: Re: [CMake] -DCMAKE_C_COMPILER:string="g++"<BR>
<BR>
Marie-Christine Vallet wrote:<BR>
> Bill Hoffman wrote:<BR>
>> Marie-Christine Vallet wrote:<BR>
>>> Hi,<BR>
>>> I would like to use g++ as my c compiler (which works) but cmake<BR>
>>> does not let me do that. Is this normal?<BR>
>>> Thanks again,<BR>
>>> Marie<BR>
>> I suspect you want to look at LINKER_LANGUAGE. You really don't want<BR>
>> to use g++ for a c compiler.<BR>
>> What are you trying to do?<BR>
>><BR>
>> -Bill<BR>
>><BR>
>><BR>
> one of the c files includes a c++ file that is why I need to compile<BR>
> my c files with g++ and not gcc. One of the solution would be to<BR>
> rename my c file cpp or cxx<BR>
> thanks,<BR>
> Marie<BR>
><BR>
You can also set the language for that .c file to CXX.<BR>
set_source_file_properties(foo.c PROPERTIES LANGUAGE CXX)<BR>
<BR>
-Bill<BR>
<BR>
_______________________________________________<BR>
CMake mailing list<BR>
CMake@cmake.org<BR>
<A HREF="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</A><BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>