[cmake-developers] Build failed in Jenkins: kdelibs_frameworks_qt5 #1806

Brad King brad.king at kitware.com
Mon Dec 2 16:57:56 EST 2013


On 12/02/2013 03:59 PM, Daniele E. Domenichelli wrote:
> For some reason a module containing something like
> 
>   function(_foo)
>     [...]
>   endfunction()
> 
>   macro(foo)
>     _foo()
>   endmacro()
> 
> will cause an endless loop when calling foo() if the file is included in
> 2 different scopes.

The function() and macro() commands rename any existing command
of the same name to one with a leading underscore.  This was added
long ago for use as local debugging and never really finished.
It is not documented behavior.

Whenever this comes up I tell people the _-rename is for local
debugging only and should not be used in practice.  Unfortunately
its ability to hook into existing commands makes it tempting to
users.  It can also trigger by accident as in the case you've seen.

This is a known bug that should be fixed.  However, I'm unsure as
to the cleanest behavior.  One simple approach is to skip the
_-rename if it would replace a function already named with _.
This would fix both the accidental conflict and the double-defined
command use cases.

-Brad



More information about the cmake-developers mailing list