[CMake] Custom commands always running

Rick McGuire object.rexx at gmail.com
Thu May 8 17:49:04 EDT 2014


Figured out the answer on my own.  The problem was how I was specifying the
file names on the depends.  Once I added the directory to the output file
and used the directory on subsequent dependencies, this started working the
way I expected.

Rick


On Thu, May 8, 2014 at 5:39 PM, Rick McGuire <object.rexx at gmail.com> wrote:

> There's something I'm not understanding about custom commands.  I have
> need to run a couple of custom commands during our build that generated
> some output files.  They are specified like this:
>
>  # Build the rexx.img file
> add_custom_command(OUTPUT rexx.img
>            COMMAND ./rexximage
>            DEPENDS rexximage rxapi rexxutil ${image_class_files} ${platform_rexx_img_depends}
>            WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
> add_custom_target(rexx_img ALL DEPENDS rexx.img)
>
>
> It produces one output file that other targets have a dependency on and it has dependencies on several files and several other targets.  This is working fine with everything occurring in the proper order, but I'm a bit surprised to see this command getting run unconditionally even if none of the command dependencies have changed.  Not a big issue, but the fact the output file gets updated means all of the subsequent build stages that have a dependency on the rexx.img file also get activated.  Why is this happening and is there anything I can do to stop this from being generated unconditionally?
>
>
> Rick
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140508/3b7c1bb3/attachment.html>


More information about the CMake mailing list