This code seems to produce the correct output with either a macro or a function prototype.<br><br><span style="font-family: courier new,monospace;">macro( foo )<br> list( APPEND my_list "+" )<br> list( LENGTH my_list length )<br>
if( length LESS ${somevar} )<br> foo()<br> endif()<br> # Add this line in for functions<br> set( my_list ${my_list} PARENT_SCOPE )<br>endmacro()<br><br>set(somevar 100)<br>set(my_list "")<br>foo()<br>message("my_list = ${my_list}")<br>
</span><br style="font-family: courier new,monospace;"><br>My guess is that the code isn't necessarily inlined, but interpreted on the fly with special rules about variable scope.<br><br>James<br><br><div class="gmail_quote">
On Fri, Jan 16, 2009 at 4:39 PM, Robert Dailey <span dir="ltr"><<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>Suppose I have a macro that rougly behaves like this:<br><br><span style="font-family: courier new,monospace;">macro( foo )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> list( APPEND my_list <something> )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if( <foo's length is less than certain number> )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> foo()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> endif()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">endmacro()</span><br><br>How would this be processed in CMake? Obviously you couldn't inline this macro because it's recursive. I need to do something like this to recursively iterate target dependencies and append all of their includes to a single, flattened list.<br>
<br>Thanks.<br>
<br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>