<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">I've got a problem that has been vexing me for several months: It seems that when I create a custom rule using add_custom_command, the DEPENDS clause sometimes works and sometimes doesn't, and I can't figure out why.<div>
<br></div><div>Here's what my custom rule looks like:</div><div><br></div><div><div><font face="'courier new', monospace"> # Link with stdlib</font></div><div><font face="'courier new', monospace"> string(REGEX REPLACE ".tart\$" ".s" ASM_FILE "${SRC_FILE}")</font></div>
<div><font face="'courier new', monospace"> add_custom_command(OUTPUT ${ASM_FILE}</font></div><div><font face="'courier new', monospace"> COMMAND tartln -disable-fp-elim -filetype=asm ${TARTLN_OPTIONS} ${BC_FILE}</font></div>
<div><font face="'courier new', monospace"> "${PROJECT_BINARY_DIR}/stdlib/stdlib.bc"</font></div><div><font face="'courier new', monospace"> "${PROJECT_BINARY_DIR}/libext/testing/testing.lib.bc"</font></div>
<div><font face="'courier new', monospace"> DEPENDS "${BC_FILE}" tartln stdlib testing.lib</font></div><div><font face="'courier new', monospace"> COMMENT "Linking Tart bitcode file ${BC_FILE}")</font></div>
<div><br></div><div>Now, the targets 'stdlib' and 'testing.lib' are almost identical in definition, however when I attempt to execute this rule it complains that it can't find a rule to build 'testing.lib'. However, I can make both stdlib and testing.lib manually by typing "make stdlib" or "make testing.lib" respectively on the command line. So I know that both targets work.</div>
<div><br></div><div>The only significant difference between the two targets, as far as I can tell, is that the testing.lib target is one level deeper in the build hierarchy. That is, in my top-level CMakeLists.txt file, I include the subdirectories "stdlib/" and "libext/testing/", which contain the CMakeLists.txt for the two libraries.</div>
<div><br></div><div>I've tried putting $PROJECT_BINARY_DIR and $CMAKE_BINARY_DIR in front of testing.lib, neither of which seems to make any difference. I've also tried depending on the actual build product (testing.lib.bc) rather than the abstract target testing.lib. Still no luck.</div>
<div><br></div><div>Can anyone suggest something else to try?</div></div></span><br>-- <br>-- Talin<br>