[CMake] -DCMAKE_C_COMPILER:string="g++"

Sanchez, Juan juan.sanchez at amd.com
Thu Aug 9 01:25:03 EDT 2007


Note that many C/C++ compilers rely on the file extension to determine whether it should be processed using C or C++.

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.

For "gcc -c"
.c  unmangled
.C  mangled 
.cc mangled

For "g++ -c"
.c mangled
.C mangled
.cc mangled

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.

Regards,

Juan










-----Original Message-----
From: cmake-bounces+juan.sanchez=amd.com at cmake.org on behalf of Bill Hoffman
Sent: Wed 8/8/2007 8:52 PM
To: Marie-Christine Vallet; cmake
Subject: Re: [CMake] -DCMAKE_C_COMPILER:string="g++"
 
Marie-Christine Vallet wrote:
> Bill Hoffman wrote:
>> Marie-Christine Vallet wrote:
>>> Hi,
>>> I would like to use g++ as my c compiler (which works) but cmake 
>>> does not let me do that. Is this normal?
>>> Thanks again,
>>> Marie 
>> I suspect you want to look at LINKER_LANGUAGE.  You really don't want 
>> to use g++ for a c compiler.
>> What are you trying to do?
>>
>> -Bill
>>
>>
> one of the c files includes a c++ file that is why I need to compile 
> my c files with g++ and not gcc. One of the solution would be to 
> rename my c file cpp or cxx
> thanks,
> Marie
>
You can also set the language for that .c file to CXX.
set_source_file_properties(foo.c PROPERTIES LANGUAGE CXX)

-Bill

_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070808/9a082595/attachment.htm


More information about the CMake mailing list