Hi All,
I've been thinking aboutallowing return values/ function evaluation in the cmake script language. Especially if there are any downsides e.g. compatibility issues/language inconsistency. What I mean is the following syntax: ``` function(func1) return(1) endfunction() function(add lhs rhs) math(EXPR res "${lhs} + ${rhs}") return(${res}) endfunction() set(result ${func1()}) # checks to see if function is defined and if so invokes it idicated by parenthesis assert(${result} EQUAL 1) set(result ${add(${func1()} 2}) # inner function is evaluated first and result is pasted in outer function assert(${result} EQUAL 3) message(INFO "${add(1 3)}") # --> prints 4 set(function_name add) message(INFO "${function_name}(3 5)}") # --> prints 8 ``` This could replace generator expressions with a cleaner and more general alternative and also it would allow cmake to become much easier to use. I'd also like to know if someone could point me to where in the cmake codebase the "${}" evaluation expression is actually processed. If you have any critique of this idea then I would also be happy - else I'll try to fork cmake and implement this. Cheers! Tobias
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake