<div class="gmail_quote">On 1 June 2012 17:22, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Not directly, but as a workaround, you could write that into a file, and then include the file.<div><br></div><div>i.e.:</div><div><br></div><div>file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/tmp.cmake" "BAR_${FOO}(arg1 arg2)")</div>
<div>include(${CMAKE_CURRENT_BINARY_DIR}/tmp.cmake)</div></blockquote><div><br>Hi, there is also a variation based on the workaround given by David:<br><br>suppose you want to call:<br> bar_${foo1}(arg1 arg2)<br>bar_${foo2}(arg1 arg2)<br>
<br>you can create 2 files:<br>- bar1.cmake<br>macro(bar)<br>...<br>endmacro()<br><br>- bar2.cmake<br>macro(bar)<br>...<br>endmacro()<br><br>After that you can replace:<br>bar_${foo1}(arg1 arg2)<br>bar_${foo2}(arg1 arg2)<br>
by:<br>include(${foo1}.cmake)<br>bar(...)<br>include(${foo2}.cmake)<br>bar(...)<br><br>where:<br>${foo1} = bar1<br>${foo2} = bar2<br><br>Regards,<br>Damien R.<br></div></div>