[CMake] Custom commands always running

Rick McGuire object.rexx at gmail.com
Thu May 8 17:39:07 EDT 2014


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/4bd55521/attachment.html>


More information about the CMake mailing list