Re: [CMake] add_custom_command not triggered

2015-10-31 Thread Nils Gladitz

On 31.10.2015 15:49, Nico Schlömer wrote:


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
)



I don't know anything about the ExternalData module but assuming this is 
unrelated ...


do you have a target that depends on the new output?
Without one the custom command does not get emitted.

E.g. add_custom_target(foobar ALL DEPENDS 
${CMAKE_BINARY_DIR}/test/data/pacman.e.2.0)
or list it in the sources of an existing add_executable() or 
add_library() target.


Nils
--

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


Re: [CMake] add_custom_command not triggered

2015-10-31 Thread David Cole via CMake
Oh wait, I read it wrong...

Try ${} to get the value of the variable. (It contains a file name, right?)


D



On Saturday, October 31, 2015, David Cole  wrote:

> 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  > 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

Re: [CMake] add_custom_command not triggered

2015-10-31 Thread David Cole via CMake
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 
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