Hi everyone,

I would like to create a CMake test that does the following:
 * Download a file from an external resource
 * Do something with the file
 * compile an executable myTest
 * execute myTest outputfile

Using ExternalData for downloading the file works well, but the second step
(file conversion, in this example cp for simplicity) does not work:
```
cmake_minimum_required(VERSION 3.2)

project(mytest)

# Download the files
INCLUDE(ExternalData)
set(
  ExternalData_URL_TEMPLATES
  "https://downloads.sourceforge.net/project/noshdata/%(algo)/%(hash)"
  )
ExternalData_Expand_Arguments(
  testFetchData
  OUT_DATA DATA{${CMAKE_SOURCE_DIR}/test.e}
  )
ExternalData_Add_Target(testFetchData)

add_custom_command(
  OUTPUT test.g
  COMMAND cp test.e test.g
  DEPENDS test.e
  )

ADD_EXECUTABLE("myTest" main.cpp)

add_test(myTest test.g)
```
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.

Hints appreciated.

Cheers,
Nico
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to