Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-09 Thread Jon Haitz Legarreta
ontag, 9. Dezember 2013 09:01 > To: Matthew Woehlke > Cc: cmake@cmake.org > Subject: Re: [CMake] [CMAKE] Getting compilation date through CMake > > BTW, just for other newbies, I think my mistake was that I took another > external command example literally: > > EX

Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-09 Thread Jakub Zakrzewski
Montag, 9. Dezember 2013 09:01 To: Matthew Woehlke Cc: cmake@cmake.org Subject: Re: [CMake] [CMAKE] Getting compilation date through CMake BTW, just for other newbies, I think my mistake was that I took another external command example literally: EXECUTE_PROCESS(   COMMAND   svnversion -nc &q

Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-09 Thread Jon Haitz Legarreta
BTW, just for other newbies, I think my mistake was that I took another external command example literally: EXECUTE_PROCESS( COMMAND svnversion -nc "${sourceDir}" OUTPUT_VARIABLE _out_svnversion ) Now I guess the above works (without invoking the command prompt) because a FindSubversion.cma

Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-08 Thread Jon Haitz Legarreta
Dear Fraser and Matthew, yes, both approaches work. Thank you. There seems to be a trailing endline in the response given by $ENV{COMSPEC} /c date /t, so the following regex helps deleting it: STRING(REGEX REPLACE "(\r?\n)+$" "" _date "${_date}") Thanks again, JON HAITZ On 5 December 2013 22:

Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-05 Thread Matthew Woehlke
On 2013-12-05 15:46, Fraser Hutchison wrote: If you can specify CMake version 2.8.11 as a minimum, you could use the string(TIMESTAMP ...) command instead: string(TIMESTAMP _output "%d/%m/%Y") Bear in mind that these only execute when CMake runs (i.e. at configure time) rather than at build tim

Re: [CMake] [CMAKE] Getting compilation date through CMake

2013-12-05 Thread Fraser Hutchison
Hi Jon, You'd have to invoke the command prompt to execute this I think.  On Windows this should be the value of the COMSPEC environment variable, so your command would be something like: execute_process(COMMAND     $ENV{COMSPEC} /c date /t     OUTPUT_VA

[CMake] [CMAKE] Getting compilation date through CMake

2013-12-05 Thread Jon Haitz Legarreta
Hi there, I was trying to get the compilation time through a CMake-executed command in order to know the compilation time of a given project. In my custom.cmake file I was using execute_process(COMMAND date -t OUTPUT_VARIABLE _output ) It turns out that the _output variable is empty when