I'm trying to implement the stuff found in

http://www.cmake.org/Bug/bug.php?op=show&bugid=1731
http://www.cmake.org/Bug/bug.php?op=show&bugid=2172
http://www.cmake.org/pipermail/cmake/2005-August/007102.html
http://www.itk.org/cgi-bin/viewcvs.cgi/Wrapping/CSwig/CMakeLists.txt?rev=1.55&root=Insight&view=auto

Here's the general idea:

Basically the custom command runs the first time because the output is
not present.  The custom command generates its output AND a list of
dependencies.  The list is dumped via copy-if-different to a file that
is read by CMake.  This causes CMake to re-run and include the list of
dependencies in the DEPENDS argument of the custom command.

I can't seem to figure out how this is working in this giant file.

CSWIG_CREATE_PYTHON_CXX_FILE seems to build the dependency file from swig:

=====================================================================
MACRO(CSWIG_CREATE_PYTHON_CXX_FILE Bin MasterIdx InputIdx InputXml OutputTclCxx Library LibraryIndexFiles)
   SET(CINDEX)
   FOREACH(MIDX ${MasterIdx})
     SET(CINDEX ${CINDEX} -Cindex "${MIDX}")
   ENDFOREACH(MIDX)
   IF("${InputXml}" MATCHES "${ITK_CSWIG_PYTHON_NO_EXCEPTION_REGEX}")
     SET(ITK_SWG_FILE "")
   ELSE("${InputXml}" MATCHES "${ITK_CSWIG_PYTHON_NO_EXCEPTION_REGEX}")
     SET(ITK_SWG_FILE "-l${ITK_TOP}/Wrapping/CSwig/itk.swg")
   ENDIF("${InputXml}" MATCHES "${ITK_CSWIG_PYTHON_NO_EXCEPTION_REGEX}")
   ADD_CUSTOM_COMMAND(
     COMMENT "${OutputTclCxx} from "
     SOURCE ${Bin}/${InputIdx}
     COMMAND ${CSWIG}
     ARGS ${ITK_SWG_FILE}
          -I${ITK_SWIG_DEFAULT_LIB}
          -I${ITK_SWIG_DEFAULT_LIB}/python
-noruntime ${CINDEX} ${IGNORE_WARNINGS} -depend ${Bin}/${InputXml}.depend
          -outdir "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}"
          -o ${Bin}/${OutputTclCxx} -python -c++ ${Bin}/${InputXml}
     TARGET ${Library}
     OUTPUTS ${Bin}/${OutputTclCxx}
DEPENDS ${LibraryIndexFiles} ${ITK_TOP}/Wrapping/CSwig/itk.swg ${ITK_TOP}/Wrapping/CSwig/itk.swg ${Bin}/${InputXml} ${CSWIG} )
ENDMACRO(CSWIG_CREATE_PYTHON_CXX_FILE)
====================================================================

However, I don't see how the dependency file is pulled into CMake.

Where is the copy-if-different in this example file?

I'm so very confused and frustrated. Perhaps someone could give me a simple example where dependency files are generated and pulled in, please.

Thanks,
James

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to