<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>
"${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake" @ONLY)<br>
add_custom_command(OUTPUT bar<br>
COMMAND "${CMAKE_COMMAND}" -P<br>
"${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake"<br>
COMMENT "Creating bar")<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'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 "bar" what I obtain is that "foo" is called.</div>
<div><br></div><div>In my project I have some "IDL" 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 "second step", <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's strange CMake cannot do this in an easy way, that's why I think I'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>