[CMake] target DEPENDS are ignored if the target is also used for the COMMAND (fwd)
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Tue Oct 27 11:16:04 EDT 2009
I would appreciate comments on this issue from the CMake developers before
I file a bug report.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
---------- Forwarded message ----------
Date: Sat, 24 Oct 2009 10:21:52 -0700 (PDT)
From: Alan W. Irwin <irwin at beluga.phys.uvic.ca>
To: cmake at cmake.org
Subject: [CMake] target DEPENDS are ignored if the target is also used for the
COMMAND
The following CMake logic fragment illustrates the issue:
add_executable(plhershey-unicode-gen ${plhershey-unicode-gen_SRCS})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h
COMMAND plhershey-unicode-gen
${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv
${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h
DEPENDS
plhershey-unicode-gen
${CMAKE_SOURCE_DIR}/fonts/plhershey-unicode.csv
)
add_custom_target(
plhershey-unicode.h_built
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/plhershey-unicode.h
)
If I touch the source for plhershey-unicode-gen and run "make
plhershey-unicode.h_built", then plhershey-unicode-gen gets rebuilt but the
custom command is not re-run. Apparently, a target is ignored as a DEPENDS
if it is also used as a COMMAND. That doesn't seem correct to me.
The workaround is to replace the COMMAND by the location of the
plhershey-unicode-gen executable. In that case, if I touch the source for
plhershey-unicode-gen and run "make plhershey-unicode.h_built", then
plhershey-unicode-gen gets rebuilt, and so does plhershey-unicode.h.
According to the documentation you should be able to use targets for
COMMANDs, and targets for DEPENDS. Furthermore according to the
documention, in the former case the file depends are not taken care of, but
in the latter case they should be (for add_executable or add_library
targets). I believe it is a bug in the implemention that the latter case is
ignored when the target is also used for the COMMAND.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
_______________________________________________
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
More information about the CMake
mailing list