[CMake] one source file should depend on every other

Denis Stuenkel dstuenkel at googlemail.com
Sat Apr 21 12:32:15 EDT 2007


a.neundorf-work wrote:
> On Thursday 12 April 2007 22:00, 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?
> 
> You could "touch" the file using  ADD_CUSTOM_COMMAND(TARGET ... COMMAND touch 
> some_file POSTBUILD)

Thanks. For now I'm going to use this:

  add_custom_command(TARGET myprog
    POST_BUILD
    COMMAND touch ${CMAKE_CURRENT_SOURCE_DIR}/version.cc)

But I think it should be PRE_BUILD.  Using POST_BUILD the 'touch'
comes to late and version.o is not rebuilt until I run make a
second time.  Unfortunatly, as I use gcc, PRE_BUILD is
treated as PRE_LINK.


More information about the CMake mailing list