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

Bill Hoffman bill.hoffman at kitware.com
Wed Aug 8 21:52:12 EDT 2007


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



More information about the CMake mailing list