[CMake] ADD_CUSTOM_COMMAND does not recognize source file property OBJECT_DEPENDS

John McGehee cmake at voom.net
Sat Jan 29 19:26:52 EST 2011


This is a question about ADD_CUSTOM_COMMAND, not SWIG, which just appears in the introduction.

I give the command,

  swig_add_module(basic csharp ${CMAKE_SOURCE_DIR}/basic.i)

And the UseSWIG.cmake makes a custom command,

  add_custom_command(
      ....
    DEPENDS
      ${CMAKE_SOURCE_DIR}/basic.i
  )

And it all works.  If I update basic.i, the custom command runs again.  So no problem with SWIG.

Here's my question.  basic.i %includes other *.i files.  swig_add_module() knows nothing about this SWIG %include mechanism, so I define this relationship myself.  I tried,

  set_source_files_properties(${CMAKE_SOURCE_DIR}/basic.i
    PROPERTIES
      OBJECT_DEPENDS ${CMAKE_SOURCE_DIR}/subBasic.i
  )

I would expect that if I update subBasic.i, the custom command would notice that a dependency of a dependency is new, and run again.  It doesn't.  I grep my entire build for "subBasic.i", and it appears in no file ("basic.i" is present in a build.make file). 

Does ADD_CUSTOM_COMMAND DEPENDS know about source file property OBJECT_DEPENDS?


John McGehee
http://www.voom.net


More information about the CMake mailing list