[CMake] functions as first class objects

David Manura dm.lua at math2.org
Wed Nov 18 21:07:40 EST 2009


On Wed, Nov 18, 2009 at 4:58 PM, Alexander Neundorf wrote:
> On Wednesday 18 November 2009, David Manura wrote:
>> That would be better than nothing, though it does have a limitation in
>> that you cannot wrap a function more than once.
> Not sure. Have you tried ?

function(test)
  message("1")
endfunction(test)
test()

function(test)
  message("2")
  _test()
endfunction(test)
test()  # ok

function(test)
  message("3")
  _test()
endfunction(test)
test()  # infinite loop

Michael's suggestion would help too, though it might be called a hack.
 The expressiveness of the language could be improved if we could
allow symbols in the function namespace to be copied or renamed:

  set(&test3 &test)  # bind function symbol "test3" to value of
function symbol "test"
  function(test)
    message("3")
    test3()
  endfunction(test)


More information about the CMake mailing list