[Cmake] Adding multiple dependencies to custom commands

William A. Hoffman billlist at nycap.rr.com
Tue, 18 May 2004 09:38:31 -0400


http://www.cmake.org/HTML/Documentation.html:

 ADD_CUSTOM_COMMAND(OUTPUT result
                     COMMAND command
                     [ARGS [args...]]
                     [MAIN_DEPENDENCY depend]
                     [DEPENDS [depends...]]
                     [COMMENT comment])


Use the DEPENDS option.

-Bill

At 12:13 AM 5/18/2004, Zachary Pincus wrote:
>Hello,
>
>I'm calling SWIG with cmake via an ADD_CUSTOM_COMMAND rule.
>Now, my SWIG interface imports several other files, so the custom command should be re-run each time any of a fair number of files changes.
>
>So what I do is the following:
>
>SET(SWIG_DEPENDS ${SWIG_DEPENDS_LOCAL} ${SWIG_SOURCE})
>
>ADD_CUSTOM_COMMAND(
>        SOURCE ${SWIG_DEPENDS}
>        COMMAND swig
>        ARGS -Wall -python -c++
>                -I${SWIG_COMMON_DIR}
>                -I${SWIG_DIR}
>                -I${SWIG_INCLUDE_HEADERDIR}
>                -o ${SWIG_CXX_OUTPUT}
>                ${SWIG_SOURCE}
>        OUTPUTS ${SWIG_CXX_OUTPUT} ${SWIG_PY_OUTPUT}
>        TARGET ${WRAPPER_NAME}
>)
>
>However, the SWIG command is only re-run when the single file listed in SWIG_SOURCE changes, and not when any of the other files change. If I change the order of the SET(SWIG_DEPENDS ...) line above, then the SWIG command is re-run only when the last file specified in SWIG_DEPENDS (whatever it is) is changed.
>
>Is there any good way to add multiple dependencies to custom commands? Is the way I'm using supposed to work?
>
>Thanks,
>
>Zach Pincus
>
>Department of Biochemistry and Program in Biomedical Informatics
>Stanford University School of Medicine
>
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake