[Cmake] Adding multiple dependencies to custom commands
Zachary Pincus
zpincus at stanford.edu
Mon, 17 May 2004 21:13:00 -0700
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