On Mon, Oct 15, 2012 at 12:54 AM, Totte Karlsson
<to...@dunescientific.com>wrote:

> Hi,
>

Hello !


> I have an executable target, that I want to be executed as part of its own
> build.
>
> The target takes one argument, which is output folder of a text file. This
> text file is part of my source dir.
>
> In my CMake file I have, at the end
>
> set( resultFileFolder "${PROJECT_SOURCE_DIR}/wiki/**reports")
> set( resultFile "${resFileFolder}/tests_auto.**xml")
>
> add_custom_command(
>     DEPENDS ${target}
>     OUTPUT ${resultFile}
>     COMMAND ${CMAKE_CURRENT_BINARY_DIR}/**bin/${target}
>     ARGS ${resultFileFolder}
>     )
>

>From the documentation (
http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_command)
I would say that DEPENDS is used to actually link the command to a physical
file to know when the command needs to be triggered again.
As a consequence, my guess would be that CMake is probably looking for that
one in the source directory :-)

You could try to put an absolute path to the DEPENDS... or, I would
actually go for a post-build action of the executable target you have
defined:
add_custom_command(TARGET ${target}
  POST_BUILD
  COMMAND ${CMAKE_CURRENT_BINARY_DIR}/**bin/${target} ${resultFileFolder}
)
Ps: ARGS is now optional.

Hope this helps and kind regards,
-- 
  Amine
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to