[Cmake] ADD_CUSTOM_COMMAND and dependency checking

Andy Cedilnik andy.cedilnik at kitware.com
Wed, 18 Feb 2004 08:41:12 -0500


Hi Zach,

If you are ok with using CMake 1.8, then you should use the new custom
commands:

Old style:
ADD_CUSTOM_COMMAND(
  SOURCE ${SRC_NAME_ROOT}.i
  OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${SRC_NAME_ROOT}_wrap.c
  COMMAND swig
  ARGS -python ${SRC_NAME_ROOT}.i
  TARGET ${SRC_NAME_ROOT} )

New style:
SET(swigtarget ${my_BINARY_DIR}/my.cxx)
SET(swigsource ${my_SOURCE_DIR}/my.i)
ADD_CUSTOM_COMMAND(
  OUTPUT ${swigtarget)
  DEPENDS ${swigsource}
  COMMAND ${SWIG_EXECUTABLE}
  ARGS -python -o "${swigtarget}" "${swigsource}")
	
				Andy

On Tue, 2004-02-17 at 22:01, Zachary Pincus wrote:
> Thank you David, that was indeed the problem.
> 
> Hopefully this will be of use to others too.