[CMake] Question about dependencies and paths

Talin viridia at gmail.com
Wed Dec 30 01:02:19 EST 2009


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.

Here's what my custom rule looks like:

  # Link with stdlib
  string(REGEX REPLACE ".tart\$" ".s" ASM_FILE "${SRC_FILE}")
  add_custom_command(OUTPUT ${ASM_FILE}
      COMMAND tartln -disable-fp-elim -filetype=asm ${TARTLN_OPTIONS}
${BC_FILE}
          "${PROJECT_BINARY_DIR}/stdlib/stdlib.bc"
          "${PROJECT_BINARY_DIR}/libext/testing/testing.lib.bc"
      DEPENDS "${BC_FILE}" tartln stdlib testing.lib
      COMMENT "Linking Tart bitcode file ${BC_FILE}")

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.

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.

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.

Can anyone suggest something else to try?

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091229/9ede3a15/attachment.htm>


More information about the CMake mailing list