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

Alexander Neundorf neundorf at kde.org
Thu May 22 15:41:35 EDT 2014


On Thursday, May 22, 2014 09:16:17 Brad King wrote:
> On 05/21/2014 04:05 PM, Nicolas Desprès wrote:
> > at the time the AST node is created the file location is frozen.
> > Locations are controlled by the lexer so do comments.
> 
> Correct.  This has to be done by the lexer.  We already have
> documentation blocks that are "indistinguishable from comments":
> 
>  #.rst:
>  # ...reStructuredText docs...
> 
>  #[=====[.rst:
>  ...reStructuredText docs...
>  #]=====]
> 
> I see no reason this can't be used for #line too:
> 
>  #.cmake-source-line: 1234 "/path/to/real/file"
> 
> In all of the above cases there is no semantic meaning to the
> comments as far as the CMake language processor is concerned.
> The last case only changes the file names and line numbers in
> backtraces.
> 
> One remaining challenge is CMAKE_CURRENT_LIST_FILE and
> CMAKE_CURRENT_LIST_LINE. 

Probably also CMAKE_CURRENT_LIST_DIR.

Alex




More information about the cmake-developers mailing list