[CMake] one source file should depend on every other

a.neundorf-work at gmx.net a.neundorf-work at gmx.net
Thu Apr 12 16:48:15 EDT 2007


On Thursday 12 April 2007 22:00, Denis Stuenkel wrote:
> Hi,
>
> currently my CMakeLists.txt looks basically like this:
>
>   file(GLOB sources *.cc)
>   add_executable(myprog ${sources})
>
> One of these cc-files just contains:
>
>   const char* build_date() {return __DATE__;}
>
> The obvious problem here is that this build-date doesn't change
> because the object stays the same until I make a change to that
> specific source file.
>
> 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)

Bye
Alex


More information about the CMake mailing list