[CMake] Adding new language.

Michael Wild themiwi at gmail.com
Tue Mar 15 05:20:00 EDT 2011


On 03/15/2011 09:53 AM, arrowdodger wrote:
> On Tue, Mar 15, 2011 at 1:44 AM, Michael Hertling <mhertling at online.de>wrote:
> 
>> To be exact, it's a rule variable which describes how to compile a C
>> source file to an object file. On my system, it currently expands to:
>>
>> <CMAKE_C_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>
>>
>> AFAIK, these rule variables can be redefined and have the usual
>> directory scope; the bracketed placeholders have a special meaning
>> when the rule is used to generate command lines in a Makefile, e.g.
>> So, you might set CMAKE_C_COMPILE_OBJECT in a directory to whatever
>> is necessary to compile a C source file to byte code while you can
>> refer to flags, preprocessor definitions and the source and object
>> file via the placeholders. With just a few files to be byte-code-
>> compiled, that's possibly more appropriate than defining a new
>> language for this purpose.
>>
>> Regards,
>>
>> Michael
> 
> 
> Thanks, it worked.
> 


Just one warning: AFAIK these rule variables are only used for
Makefile-based generators, *NOT* for Xcode and VisualStudio and the
like. I'd prefer the route via add_custom_command/add_custom_target...

Michael


More information about the CMake mailing list