[CMake] How to choose different complier?

董隆超 donglongchao at 163.com
Tue Oct 19 00:02:35 EDT 2010






At 2010-10-18 17:30:01,"Eric Noulard" <eric.noulard at gmail.com> wrote:

>2010/10/18 董隆超 <donglongchao at 163.com>:
>> Hi,everybody
>>
>> I am new to CMake and I have a question.
>> I think CMake choose complier based on the file name.If it is ".cpp",CMake
>> will use g++, if it is ".c",gcc will be used.Is it right?So to switch
>> between g++ and gcc,I have to change the file name every time.I know this is
>> very stupid,but I really do not know how to choose special complier by
>> hand.If the file name is ended with ".c",I want to use g++ to compile it.So
>> how to do?
>> Thank you in advance.
>
>set_source_files_properties(yourfile.c LANGUAGE CXX)
>
>see:
>
>cmake --help-command set_source_files_properties
>
>-- 
>Erk
>Membre de l'April - « promouvoir et défendre le logiciel libre » -
>http://www.april.org

Thank you very much.
I use SET_SOURCE_FILES_PROPERTIES(myfile.c PROPERTIES LANGUAGE CXX),and it works.I am using cmake version 2.6-patch 4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101019/311aaa89/attachment.htm>


More information about the CMake mailing list