<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Jon,<br>
    <br>
    You'd have to invoke the command prompt to execute this I think.&nbsp; On
    Windows this should be the value of the COMSPEC environment
    variable, so your command would be something like:<br>
    <br>
    <code>execute_process(COMMAND</code><code><br>
    </code><code>&nbsp;&nbsp;&nbsp; $ENV{COMSPEC} /c date /t</code><code><br>
    </code><code>&nbsp;&nbsp;&nbsp; OUTPUT_VARIABLE _output</code><code><br>
    </code><code>)</code><code><br>
    </code><br>
    However, this is Windows-specific.&nbsp; If you can specify CMake version
    2.8.11 as a minimum, you could use the<code> string(TIMESTAMP ...)</code><code>
    </code>command instead:<br>
    <br>
    <code>string(TIMESTAMP _output "%d/%m/%Y")</code><br>
    <br>
    Bear in mind that these only execute when CMake runs (i.e. at
    configure time) rather than at build time, so strictly-speaking
    you're not actually grabbing the compile date.<br>
    <br>
    Cheers,<br>
    Fraser.<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 05/12/2013 19:32, Jon Haitz
      Legarreta wrote:<br>
    </div>
    <blockquote
cite="mid:CAAKhGh9YfWAa9Ti7gE-MpjaK0VhFtt5tC_f9UPpMgCHGGrBhiQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi there,<br>
        I was trying to get the compilation time through a
        CMake-executed command in order to know the compilation time of
        a given project.<br>
        In my custom.cmake file I was using<br>
        <br>
        execute_process(COMMAND<br>
        &nbsp;&nbsp;&nbsp; date -t <br>
        &nbsp;&nbsp;&nbsp; OUTPUT_VARIABLE _output <br>
        )<br>
        <br>
        It turns out that the _output variable is empty when I compile
        my project. However, the command works well from the command
        line. I'm working on a Win 7&nbsp; 64-bit machine.<br>
        <br>
        I wanted to avoid using an extra C/C++ code file to get the
        current time.<br>
        <br>
        Am I missing something?<br>
        <br>
        Thank you,<br>
        JON HAITZ
        <div>
          <div dir="ltr">
            <table cellpadding="0" cellspacing="0" align="center"
              border="0">
              <tbody>
                <tr>
                  <td><br>
                  </td>
                </tr>
                <tr>
                  <td>
                    <table cellpadding="0" align="center" border="0">
                      <tbody>
                        <tr>
                          <td><span
style="font-size:10px;color:gray;font-family:Verdana,Arial,Helvetica,sans-serif"></span><br>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">--

Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Please keep messages on-topic and check the CMake FAQ at: <a class="moz-txt-link-freetext" href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a>

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: <a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/support.html</a>
CMake Consulting: <a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/consulting.html</a>
CMake Training Courses: <a class="moz-txt-link-freetext" href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/training.html</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a></pre>
    </blockquote>
    <br>
  </body>
</html>