Ken Martin wrote:
> I checked into CVS two new commands; function and raise_scope (well three
> commands if you count endfunction)

I'm having troubles with functions, the next example gives me an exception

function(foo x)
 set(x 1)
 raise_scope(${x})
endfunction()

foo(y)
message(STATUS "y=${y}")

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Aborted

If I change ${x} to x the result y is not defined:
unction(foo x)
  set(x 1)
  raise_scope(x)
endfunction()

foo(y)
message(STATUS "y=${y}")
-- y=
-- Configuring done
-- Generating done

And the next example works:
function(foo z)
  set(x 1)
  raise_scope(x)
endfunction()

foo(f)
message(STATUS "x=${x}")
-- x=1
-- Configuring done
-- Generating done

If I understand your example, the raise_scope is the way to return
values from functions.

Thanks
--
Filipe Sousa

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to