<!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=&quot;g++&quot;</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 &quot;gcc -c&quot;<BR>
.c&nbsp; unmangled<BR>
.C&nbsp; mangled<BR>
.cc mangled<BR>
<BR>
For &quot;g++ -c&quot;<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=&quot;g++&quot;<BR>
<BR>
Marie-Christine Vallet wrote:<BR>
&gt; Bill Hoffman wrote:<BR>
&gt;&gt; Marie-Christine Vallet wrote:<BR>
&gt;&gt;&gt; Hi,<BR>
&gt;&gt;&gt; I would like to use g++ as my c compiler (which works) but cmake<BR>
&gt;&gt;&gt; does not let me do that. Is this normal?<BR>
&gt;&gt;&gt; Thanks again,<BR>
&gt;&gt;&gt; Marie<BR>
&gt;&gt; I suspect you want to look at LINKER_LANGUAGE.&nbsp; You really don't want<BR>
&gt;&gt; to use g++ for a c compiler.<BR>
&gt;&gt; What are you trying to do?<BR>
&gt;&gt;<BR>
&gt;&gt; -Bill<BR>
&gt;&gt;<BR>
&gt;&gt;<BR>
&gt; one of the c files includes a c++ file that is why I need to compile<BR>
&gt; my c files with g++ and not gcc. One of the solution would be to<BR>
&gt; rename my c file cpp or cxx<BR>
&gt; thanks,<BR>
&gt; Marie<BR>
&gt;<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>