<br><div class="gmail_quote"><br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
And then configure and run it like this:<br>
<br>
CMakeLists.txt:<br>
---------------<br>
# ...<br>
configure_file(<a href="http://foo_wrapper.cmake.in" target="_blank">foo_wrapper.cmake.in</a><br>
    &quot;${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake&quot; @ONLY)<br>
add_custom_command(OUTPUT bar<br>
  COMMAND &quot;${CMAKE_COMMAND}&quot; -P<br>
    &quot;${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake&quot;<br>
  COMMENT &quot;Creating bar&quot;)<br>
<br>
<br>
If you need to pass the script variables using the -D flags, make sure<br>
to pass them before the -P flag, otherwise they are silently ignored.<br>
<br>
I hope you get the idea.<br><br></blockquote><div><br></div><div><br></div></div><div>I fear I&#39;ve not explained enough the problem. </div><div><br></div><div>If I understood correctly your solution when in my CMakeLists.txt I execute the custom command &quot;bar&quot; what I obtain is that &quot;foo&quot; is called.</div>

<div><br></div><div>In my project I have some &quot;IDL&quot; files written in a custom format, those files require a preprocessing pass to be transformed in .h/.cpp, that I perform using add_custom_command() inside a macro </div>

<div><br></div><div><div>ADD_CUSTOM_COMMAND(</div><div>     OUTPUT ${PROJECT_SOURCE_DIR}/inc/intf/${_out_FILE}.h</div><div>     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}</div><div>     COMMAND idlcc</div><div>     ARGS -V -S -s ${PROJECT_SOURCE_DIR}/inc/intf -I${PROJECT_SOURCE_DIR}/inc/intf -I${PROJECT_SOURCE_DIR}/inc  ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}</div>

<div> )</div></div></div><br clear="all">The command <b>idlcc</b> is bundled within the repository and is in the directory $PROJECT_SOURCE_DIR/ext_bin/DFC, I can call it directly with a path, changing<div><br></div><div>
COMMAND idlcc</div>
<div><br></div><div>to</div><div><br><div>COMMAND ${PROJECT_SOURCE_DIR}/ext_bin/DFC/idlcc</div><div><br></div><div>...but the problem is that idlcc calls its &quot;second step&quot;, <b>dfc_idl</b>, that is in the same directory, and pretend it to be in the command search path.</div>

<div><br></div><div>the previous makefile used to do:</div><div><br></div><div>export PATH=$PROJECT_DIR/ext/bin/DFC:$PATH</div><div><br></div><div>The exported path is used by idlcc that is launched from the Makefile and that can find dfc_idl without problems.</div>

<div><br></div><div>I need to mimic this behaviour in CMake.</div><div><br></div><div>It seems a very simple task, I can see similar problems with LD_LIBRARY_PATH in other projects, it&#39;s strange CMake cannot do this in an easy way, that&#39;s why I think I&#39;m missing something.</div>

<div><br></div><div>ATM my solution is to manually do</div><div><br></div><div>export PATH=basedir/ext_bin/DFC/idlcc:$PATH </div><div><b><br></b></div><div><b>BEFORE</b> building.</div><div><br></div><div>-- <br>Bye,
</div></div><div> Gabry</div><div><br></div><div><br></div></div>