Automatic building app version if any one of the dependency is changed.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Automatic building app version if any one of the dependency is changed.

vivek goel
Hi, 
I am buidilng 5 binary using cmake. 
Currently I am using svn source code version as app version for the application but it does not scale enough because if any file changed it force building of all the binary. 
Is there a way I can generate application specific version file only if any dependency of app executable is changed ?


regards
Vivek Goel


--

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 | Threaded
Open this post in threaded view
|

Re: Automatic building app version if any one of the dependency is changed.

Andreas Pakulat-2
Hi,

On Wed, Oct 17, 2012 at 9:02 PM, Vivek Goel <[hidden email]> wrote:
> Hi,
> I am buidilng 5 binary using cmake.
> Currently I am using svn source code version as app version for the
> application but it does not scale enough because if any file changed it
> force building of all the binary.
> Is there a way I can generate application specific version file only if any
> dependency of app executable is changed ?

Can you post example cmake code of how you're doing things? I'm not
quite understanding what you currently do and what exact behaviour you
see. Basically when you setup a target in CMake with a list of source
files, then that target is only rebuilt if one of the sources changes.
How this change is detected depends on the generator you use, for
example the Makefile generator will check the modification timestamps
of the files. So if svn changes the modification times of files on
every update then you're screwed when using makefiles. Find out why
that happens (are you maybe using an $Id$ tag in your source files?)
and fix that or switch to another generator.

Andreas
--

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 | Threaded
Open this post in threaded view
|

Re: Automatic building app version if any one of the dependency is changed.

vivek goel
Sorry as my post was not clear enough. 
I think my problem is not cmake specific. But may be I can get some better solution here. 

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. 




Now as 
regards
Vivek Goel



On Thu, Oct 18, 2012 at 12:40 AM, Andreas Pakulat <[hidden email]> wrote:
Hi,

On Wed, Oct 17, 2012 at 9:02 PM, Vivek Goel <[hidden email]> wrote:
> Hi,
> I am buidilng 5 binary using cmake.
> Currently I am using svn source code version as app version for the
> application but it does not scale enough because if any file changed it
> force building of all the binary.
> Is there a way I can generate application specific version file only if any
> dependency of app executable is changed ?

Can you post example cmake code of how you're doing things? I'm not
quite understanding what you currently do and what exact behaviour you
see. Basically when you setup a target in CMake with a list of source
files, then that target is only rebuilt if one of the sources changes.
How this change is detected depends on the generator you use, for
example the Makefile generator will check the modification timestamps
of the files. So if svn changes the modification times of files on
every update then you're screwed when using makefiles. Find out why
that happens (are you maybe using an $Id$ tag in your source files?)
and fix that or switch to another generator.

Andreas


--

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 | Threaded
Open this post in threaded view
|

Re: Automatic building app version if any one of the dependency is changed.

Matthew Woehlke-2
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