[cmake-developers] What about #line like feature in cmake language?

Matthew Woehlke mw_triad at users.sourceforge.net
Wed May 21 15:31:52 EDT 2014


On 2014-05-21 15:24, Nicolas Desprès wrote:
> On Wed, May 21, 2014 at 8:06 PM, Matthew Woehlke wrote:
>> On 2014-05-15 08:36, Ben Boeckel wrote:
>>> This will also likely need a policy since there's no guarantee that
>>> #line "directives" don't exist in already existing code as comments.
>>
>> Maybe we should not introduce pragma-like constructs that are
>> indistinguishable from comments? :-)
>>
>> TBH I'd be a little ambivalent about such a feature. A line pragma
>> itself isn't too bad, but opening the door for other types of pragmas
>> makes me a little more nervous :-).
>
> If it is possible I would rather prefer a cmake macro too.

I don't see why not... in fact it may be easier, since you won't have to
fiddle with the parsing at all.

My knee-jerk inclination is to add a 'pragma()', e.g. 'pragma(LINE 15
FILE foo.py)', except then I feel like there should be at least a
'pragma(POLICY)' also :-). (See previous comment about it sliding into a
major feature.)

Maybe something like 'set_reference()' / 'set_script_source()' could be
used instead.

-- 
Matthew




More information about the cmake-developers mailing list