Hi

On 10/15/2012 12:54 AM, Totte Karlsson wrote:
> Hi, 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")

First things first: You should *never* pollute your source tree, always
output to the build tree.

> 
> add_custom_command( DEPENDS ${target} OUTPUT ${resultFile} COMMAND
> ${CMAKE_CURRENT_BINARY_DIR}/bin/${target} ARGS ${resultFileFolder} )
> 
> Now, this never seem to execute. No warnings, no nothing.
> 
> How to get it going?
> 
> -totte
> 

You need a top-level target that DEPENDS on the output, that's all. E.g.

add_custom_target(createWikiReports ALL DEPENDS ${resultFile})

BTW: You don't need to specify the full path to the executable in the
COMMAND, and also no DEPENDS on it in the custom command. Just use the
target name, and CMake will handle the rest for you.

HTH

Michael
--

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