Re: [CMake] Building a Version Header

2010-07-11 Thread Michael Hertling
On 07/09/2010 01:23 PM, Johannes Stallkamp wrote: Am 09.07.2010 12:56, schrieb Michael Hertling: As the version target is always out of date it will be build each time you (re)build main, but since CONFIGURE_FILE() obviously does not touch the output file as long as it won't change, version.h

Re: [CMake] Building a Version Header

2010-07-09 Thread Johannes Stallkamp
Hi, Am 08.07.2010 22:31, schrieb Tyler Roscoe: On Wed, Jul 07, 2010 at 10:43:15PM -0400, John Drescher wrote: On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I would like to generate file that looks something like this: // version.h #define VERSION

Re: [CMake] Building a Version Header

2010-07-09 Thread Marcel Loose
Hi Daniel, Clark, I've got a solution that rebuilds a .h and .cc file whenever anything has changed in your working copy, e.g. an 'svn update'. It also records local modifications that have not been checked in yet. However, if you plan to include this version header file in *every* source you're

Re: [CMake] Building a Version Header

2010-07-09 Thread Michael Hertling
On 07/08/2010 10:31 PM, Tyler Roscoe wrote: On Wed, Jul 07, 2010 at 10:43:15PM -0400, John Drescher wrote: On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I would like to generate file that looks something like this: // version.h #define VERSION

Re: [CMake] Building a Version Header

2010-07-09 Thread Johannes Stallkamp
Am 09.07.2010 12:56, schrieb Michael Hertling: As the version target is always out of date it will be build each time you (re)build main, but since CONFIGURE_FILE() obviously does not touch the output file as long as it won't change, version.h isn't timestamped, so it doesn't trigger the

Re: [CMake] Building a Version Header

2010-07-08 Thread Tyler Roscoe
On Wed, Jul 07, 2010 at 10:43:15PM -0400, John Drescher wrote: On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I would like to generate file that looks something like this:    // version.h    #define VERSION v0.1-345-ga77ede8 You want to do that with

Re: [CMake] Building a Version Header

2010-07-08 Thread Daniel Blezek
One alternative is to use git itself. There is a git smudge option that can do much of what you are asking. However, I've never done this sort of thing. http://progit.org/book/ch7-2.html Just $0.02, -dan On 7/8/10 3:31 PM, Tyler Roscoe ty...@cryptio.net wrote: On Wed, Jul 07, 2010 at

Re: [CMake] Building a Version Header

2010-07-08 Thread Daniel Blezek
Sounds good. Incidentally, we did something similar with Subversion, but I never got it to work 100% of the time. Glad it works well for you! Cheers, -dan On 7/8/10 3:54 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I don't want it run every commit, I want it run every build. Right now,

[CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
I would like to generate file that looks something like this: // version.h #define VERSION v0.1-345-ga77ede8 where the version string is the result of running git describe --tags --dirty. How can I auto-generate this file, include it in my project, and have it regenerate as a pre-build

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I would like to generate file that looks something like this:    // version.h    #define VERSION v0.1-345-ga77ede8 where the version string is the result of running git describe --tags --dirty. How can I auto-generate

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Couple things wrong with this: 1) I'm using git 2) If it outputs to the build directory, how do I refer to it? On 07/07/10 22:43, John Drescher wrote: On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel cg.wowus...@gmail.com wrote: I would like to generate file that looks something like this:

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
1) I'm using git I know. You have some work to do.. On top of the minor differences in what you want the FindGIt.cmake does not have that option to return the version so you need to adapt it to get the git version similar to the way the FindSubversion.cmake module does for subversion

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Is there any way I can use the output from a command-line program (in this case, git describe --dirty) instead of using FindGit? On 07/07/10 22:58, John Drescher wrote: 1) I'm using git I know. You have some work to do.. On top of the minor differences in what you want the FindGIt.cmake

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
On Wed, Jul 7, 2010 at 10:59 PM, Clark Gaebel cg.wowus...@gmail.com wrote: Is there any way I can use the output from a command-line program (in this case, git describe --dirty) instead of using FindGit? I believe add_custom_command but I can not help with an example of that. John

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
On Wed, Jul 7, 2010 at 11:04 PM, John Drescher dresche...@gmail.com wrote: On Wed, Jul 7, 2010 at 10:59 PM, Clark Gaebel cg.wowus...@gmail.com wrote: Is there any way I can use the output from a command-line program (in this case, git describe --dirty) instead of using FindGit? I believe

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Thank you! That's perfect. I just KNEW there would be a command to do that! On 07/07/10 23:10, John Drescher wrote: On Wed, Jul 7, 2010 at 11:04 PM, John Drescher dresche...@gmail.com wrote: On Wed, Jul 7, 2010 at 10:59 PM, Clark Gaebel cg.wowus...@gmail.com wrote: Is there any way I

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Okay, I've almost got it. How do I make configure_file generate something like... source: #cmakedefine VERSION result: #define VERSION v0.1-abcdef where v0.1-abcdef is the contents of the variable PROJECT_VERSION in my CMakeLists.txt On 07/07/10 23:10, John Drescher wrote: On Wed, Jul 7, 2010

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
On Wed, Jul 7, 2010 at 11:43 PM, Clark Gaebel cg.wowus...@gmail.com wrote: Okay, I've almost got it. How do I make configure_file generate something like... source: #cmakedefine VERSION Some thing like Version.h.in #define VERSION @PROJECT_VERSION@ Try to look at my first example for

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Nice. that works. I'm so sorry to be such a bother, but here's my output now... #define PROJECT_VERSION v0.1-345-ga77ede8-dirty Needless to say, that's bad :( How would I go about removing that trailing newline? On 07/07/10 23:49, John Drescher wrote: On Wed, Jul 7, 2010 at 11:43 PM, Clark

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
Nice. that works. I'm so sorry to be such a bother, but here's my output now... #define PROJECT_VERSION v0.1-345-ga77ede8-dirty Needless to say, that's bad :( How would I go about removing that trailing newline? STRING(REGEX REPLACE on the PROJECT_VERSION in your CMakeLists.txt there

Re: [CMake] Building a Version Header

2010-07-07 Thread John Drescher
On Wed, Jul 7, 2010 at 11:58 PM, John Drescher dresche...@gmail.com wrote: Nice. that works. I'm so sorry to be such a bother, but here's my output now... #define PROJECT_VERSION v0.1-345-ga77ede8-dirty Needless to say, that's bad :( How would I go about removing that trailing newline?

Re: [CMake] Building a Version Header

2010-07-07 Thread Clark Gaebel
Oh my god you're a genius. Thank you so much, kind sir! It works now! On 07/08/10 00:00, John Drescher wrote: On Wed, Jul 7, 2010 at 11:58 PM, John Drescher dresche...@gmail.com wrote: Nice. that works. I'm so sorry to be such a bother, but here's my output now... #define