On 2012-10-17 15:24, Vivek Goel wrote:
Using CMake I am generating a common version file.
version.h which contains current svn version of source code.
In all application main.c I am including this file.
Now every application is depending on this version.h
and everything got rebuild.

I want to change this logic so application will have their own version and
version.h file should be generated only if any other dependency of
application is changed.

If you were using git, you could use something like 'git log -1 <list of files that affect the build of MyFooApp>', and put that in version.h for MyFooApp (and similar for other applications). I imagine you can do something similar with svn.

The trick is getting the list of files that affect the build of MyFooApp (depending on how pedantic a definition of "affects the build" you need).

If you don't mind creating version.h being a bit expensive, you could write a CMake script to collect the names of all files in your source tree that do not belong to other applications. If you don't care about e.g. top-level build configuration, libraries in your project, etc. (i.e. only files in src/apps/foo), then it's a little easier.

--
Matthew

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to