<div dir="ltr">Thanks for the hints!<div>I'm almost there now, the only thing missing is to have my test depend on the custom_target. This</div><div>```</div><div><div>SET_TESTS_PROPERTIES(testname PROPERTIES DEPENDS convert)</div></div><div>```</div><div>doesn't do the trick: The target `convert` isn't executed before `ctest`.</div><div><br></div><div>Any hints?</div><div><br></div><div>Cheers,</div><div>Nico</div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Nov 22, 2015 at 3:18 AM David Cole <<a href="mailto:DLRdave@aol.com" target="_blank">DLRdave@aol.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you try using full path names for the add_custom_command file names?<div><br></div><div>And the NAME/COMMAND form of the add_test command?<br><br>Also, I've always found custom commands to work best when they're associated with a target. And if it was part of a target you could make the target depend on the external data target with add_dependencies if necessary.</div><div><br></div><div><br></div><div>HTH,</div><div>David C.</div><div><br><br>On Saturday, November 21, 2015, Nico Schlömer <<a href="mailto:nico.schloemer@gmail.com" target="_blank">nico.schloemer@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi everyone,</div><div><br></div>I would like to create a CMake test that does the following:<br> * Download a file from an external resource<br> * Do something with the file<br> * compile an executable myTest<br> * execute myTest outputfile<br><br>Using ExternalData for downloading the file works well, but the second step (file conversion, in this example cp for simplicity) does not work:<div>```</div><div><div>cmake_minimum_required(VERSION 3.2)</div><div><br></div><div>project(mytest)</div><div><br></div><div># Download the files</div><div>INCLUDE(ExternalData)</div><div>set(</div><div>  ExternalData_URL_TEMPLATES</div><div>  "<a href="https://downloads.sourceforge.net/project/noshdata/%(algo)/%(hash)" target="_blank">https://downloads.sourceforge.net/project/noshdata/%(algo)/%(hash)</a>"</div><div>  )</div><div>ExternalData_Expand_Arguments(</div><div>  testFetchData</div><div>  OUT_DATA DATA{${CMAKE_SOURCE_DIR}/test.e}</div><div>  )</div><div>ExternalData_Add_Target(testFetchData)</div><div><br></div><div>add_custom_command(</div><div>  OUTPUT test.g</div><div>  COMMAND cp test.e test.g</div><div>  DEPENDS test.e</div><div>  )</div><div><br></div><div>ADD_EXECUTABLE("myTest" main.cpp)</div><div><br></div><div>add_test(myTest test.g)</div>```<br>I suppose I'm missing something about the dependencies here; after all, the `add_custom_command` has to wait for `testFetchData` to complete. Likewise, `add_test` has to wait for `add_custom_command` to complete.<br><br>Hints appreciated.</div><div><br></div><div>Cheers,</div><div>Nico</div></div>
</blockquote></div>
</blockquote></div></div>