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
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to