[CMake] add_custom_command: update dependencies over rebuilds

kvolkov at fastmail.net kvolkov at fastmail.net
Tue Apr 21 19:12:58 EDT 2015


Hello,

Is there a way to to update add_custom_command dependencies over project
rebuilds ?

Current status
- code generator that builds set of sources taking one input file as
parameter
- codegen input file may include other input files
- already solved task of getting list of output files, parsing input 
  codegen files to get full list of   codegen inputs. 
  I.e. add_custom_command is provided with correct set of dependencies
  for the first time:

    add_custom_command(OUTPUT ${generatedSources}
                       COMMAND ${codegenCommand} ARGS ${codegenArgs}
                       DEPENDS ${codegenInputFiles})

Problem scenario
    Current system works well until someone modifies one of codegen
    input files
    to include new input file or remove include of existing one. 
    This case, it is required to update list of codegen input file 
    provided to add_custom_command as dependencies, but I have no idea
    how.

P.S. From description of IMPLICIT_DEPENDS, it looks that I need hooks to
register my language scanner,
     to have dependencies updated during build time like it is done for
     C/C++ code

Thanks!
Konstantin


More information about the CMake mailing list