<div dir="ltr"><div><div>Dear Fraser and Matthew,<br></div>yes, both approaches work. Thank you.<br><br>There seems to be a trailing endline in the response given by $ENV{COMSPEC} /c date /t, so the following regex helps deleting it:<br>
<br>STRING(REGEX REPLACE &quot;(\r?\n)+$&quot; &quot;&quot; _date &quot;${_date}&quot;)<br><br></div>Thanks again,<br>JON HAITZ<br><br><br><div><div class="gmail_extra"><br><div class="gmail_quote">On 5 December 2013 22:34, Matthew Woehlke <span dir="ltr">&lt;<a href="mailto:matthew.woehlke@kitware.com" target="_blank">matthew.woehlke@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On 2013-12-05 15:46, Fraser Hutchison wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you can specify CMake version 2.8.11 as a minimum, you could use<br>
the string(TIMESTAMP ...) command instead:<br>
<br>
string(TIMESTAMP _output &quot;%d/%m/%Y&quot;)<br>
<br>
Bear in mind that these only execute when CMake runs (i.e. at configure time)<br>
rather than at build time, so strictly-speaking you&#39;re not actually grabbing the<br>
compile date.<br>
</blockquote>
<br></div>
Of course you could put that in a CMake script and execute it with e.g. &#39;${CMAKE_COMMAND} -p ${CMAKE_CURRENT_SOURCE_DIR}/<u></u>get_date.cmake&#39; in a custom command :-). Then it would truly be the compile date. (Needless to say, the script would need to write the date into some generated source file, e.g. with configure_file.)<span class=""><font color="#888888"><br>

<br>
-- <br>
Matthew</font></span><div class=""><div class="h5"><br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/<u></u>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/<u></u>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/<u></u>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/<u></u>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/<u></u>listinfo/cmake</a><br>
</div></div></blockquote></div><br></div></div></div>