Because you're giving DEPENDS as a target name, this is only an ordering
dependency, stating that the command should run after the target is built.
But not necessarily re-build whenever the target is re-built...

If you want to re-run the command based on a file changing instead, then
use the full path to a file name as your DEPENDS argument. The downloaded
file itself, or the extracted data file the command uses would probably be
reasonable choices.

Read the DEPENDS section of
https://cmake.org/cmake/help/v3.3/command/add_custom_command.html carefully.


HTH,
David C.


On Saturday, October 31, 2015, Nico Schlömer <nico.schloe...@gmail.com>
wrote:

> After downloading a file with ExternalData_Expand_Arguments [1], I would
> like to execute a command on the data to produce another file. So far, I
> have
> ```
> ExternalData_Expand_Arguments(
>   noshTestFetchData
>   OUT_DATA DATA{${CMAKE_SOURCE_DIR}/test/data/${file}}
> )
> ExternalData_Add_Target(noshTestFetchData)
>
> add_custom_command(
>   OUTPUT ${CMAKE_BINARY_DIR}/test/data/pacman.e.2.0
>   COMMAND decomp -p 2 ${CMAKE_BINARY_DIR}/test/data/pacman.e
>   DEPENDS noshTestFetchData
> )
> ```
> The file is downloaded alright, but the `add_custom_command` is never
> triggered. Why not?
>
> This is with CMake 3.2.2.
>
> Cheers,
> Nico
>
> [1] https://cmake.org/cmake/help/v3.3/module/ExternalData.html
>
-- 

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