[CMake] Re: one source file should depend on every other

Denis Stuenkel dstuenkel at googlemail.com
Sat Apr 21 12:59:09 EDT 2007


Matthew Woehlke wrote:
> Denis Stuenkel wrote:
> > How can I tell cmake that I want this file to be rebuilt every
> > time I make a change to one of the other source files?
> 
> It sounds like you want to "See the OBJECT_DEPENDS option in 
> SET_SOURCE_FILES_PROPERTIES to add file-level dependencies to object 
> files." I.e. make the object of your build_date source depend on every 
> other source.

Thanks.  I came across that before but I didn't find a way to do
this decently.  The problem is the syntax of
SET_SOURCE_FILES_PROPERTIES.  It's not possible to specify a list
of files after OBJECT_DEPENDS.  So I tried the following:

  foreach(src ${sources})
    set_source_files_properties(version.cc
      PROPERTIES OBJECT_DEPENDS ${src})
  endforeach(src)

But it seems that a second call to s_s_f_p just overwrites the
file's previous properties.

If setting OBJECT_DEPENDS is archaic anyway, how would you do
something like this?  Although the current solution using
add_custom_command/touch is OK for me, I think the more cleaner
way would be to tell cmake there is a dependency.


More information about the CMake mailing list