title: How to measure compile time per object in CMake?
body: <p>I'm searching for tool that helps calculate compilation time using CMake. 
  Target project builds a lot of files, so I need to craft some "table" per each module. For example, project consists of 2 files - main.cc and libs.cc I need to calculate build time for libs and main differently.</p>
  
  <p>I'm trying to set wrapper for g++, but in <code>make -j4</code> it has some "race condition". Strings with Building status and building time are crossing.</p>
  
  <pre><code>.......
  [  3%] Building CXX object irohad/simulator/CMakeFiles/block_creator_common.dir/block_creator_common.o
  0.12    1.42
  [  4%] Building CXX object schema/CMakeFiles/yac_grpc.dir/yac.grpc.pb.o
  0.13    1.36
  0.10    0.71
  .......
  </code></pre>
  
  <p>Set new "Compiler" - wrapper for g++</p>
  
  <pre><code>#!/bin/bash
  { /usr/bin/time -f "%S\t%U" g++ "$@"; } 2&gt; &gt;(cat &lt;(echo "g++ $@") - | cat)
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>cmake -H. -Bbuild -DCMAKE_CXX_COMPILER=/path/to/script.sh
  make | tee -a buildResults.txt
  
  
  </code></pre>