<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi Haocheng,<br>
    <br>
    thanks for helping.<br>
    I guess this has to do with another issue. The Ninja generator
    generates different paths then the default Unix Makefile generator.<br>
    <br>
    This leads to the following behavior in normal build operations:<br>
    I introduced a warning in the printf line to demonstrate this.<br>
    <br>
    With Makefiles: mkdir bld && cd bld && cmake ..<br>
    Build inside Vim using ":make" <br>
    <br>
    <tt>[ 50%] Building C object CMakeFiles/demo.dir/main.c.o</tt><tt><br>
    </tt><tt>/home/gergap/tmp/demo/main.c: In function ‘main’:</tt><tt><br>
    </tt><tt>/home/gergap/tmp/demo/main.c:5:12: warning: format ‘%i’
      expects a matching ‘int’ argument [-Wformat=]</tt><tt><br>
    </tt><tt>     printf("Hello World %i\n");</tt><tt><br>
    </tt><tt>            ^</tt><tt><br>
    </tt><tt>[100%] Linking C executable demo</tt><tt><br>
    </tt><tt>[100%] Built target demo</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Press ENTER or type command to continue<br>
      <br>
    </tt>as you can see the warning message contains the absolute path,
    so parsing the errors works for Vim (Emacs, or whatever tool),<br>
    and you can jump to the error location.<tt><br>
    </tt><br>
    Now the same with Ninja: mkdir bld && cd bld &&
    cmake -GNinja ..<br>
    Build inside Vim using ":make" (use ":set makeprg=ninja" first)<br>
    <br>
    <tt>cd into build dir '/home/gergap/tmp/demo/bld/../bld'...</tt><tt><br>
    </tt><tt>executing ninja...</tt><tt><br>
    </tt><tt>[1/2] Building C object CMakeFiles/demo.dir/main.c.o</tt><tt><br>
    </tt><tt>../main.c: In function ‘main’:</tt><tt><br>
    </tt><tt>../main.c:5:12: warning: format ‘%i’ expects a matching
      ‘int’ argument [-Wformat=]</tt><tt><br>
    </tt><tt>     printf("Hello World %i\n");</tt><tt><br>
    </tt><tt>            ^</tt><tt><br>
    </tt><tt>[2/2] Linking C executable demo</tt><tt><br>
    </tt><tt>cd back</tt><tt><br>
    </tt><tt>/home/gergap/tmp/demo/bld</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Press ENTER or type command to continue<br>
      <br>
    </tt>As you can see now the paths are relative to the build folder,
    thus jumping to the error location only works when Vim has the build
    folder set as working dir,<br>
    and this is typically not the case.<br>
    This is quite annoying, inconsistent with Makefiles and was already
    reported once here:
    <a class="moz-txt-link-freetext" href="https://cmake.org/Bug/print_bug_page.php?bug_id=13894">https://cmake.org/Bug/print_bug_page.php?bug_id=13894</a><br>
    AFAIK this was never fixed.<br>
    <br>
    Now I suspect this to be also the reason for the coverage issues.<br>
    I hope this helps.<br>
    <br>
    <div class="moz-signature"><br>
    </div>
    <div class="moz-cite-prefix">On 09/01/2017 04:09 PM, Haocheng Liu
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACbTE7N=MCC7TsQGcekf2S1s3xkpYEPA6C5J3TR1GURheet73w@mail.gmail.com">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Fri, Sep 1, 2017 at 9:41 AM,
            Gerhard Gappmeier <span dir="ltr"><<a
                href="mailto:gerhard.gappmeier@ascolab.com"
                target="_blank" moz-do-not-send="true">gerhard.gappmeier@ascolab.com</a>></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 bgcolor="#FFFFFF"> Hi Haocheng,<br>
                <br>
                `chcp` seems to be a Windows command.<br>
                I'm talking about Linux, which is UTF-8 by default:<br>
                <br>
                <tt>$> locale</tt><tt><br>
                </tt><tt>LANG=en_US.utf8</tt><tt><br>
                </tt><tt>LC_CTYPE="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_NUMERIC="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_TIME="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_COLLATE="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_MONETARY="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_MESSAGES="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_PAPER="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_NAME="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_ADDRESS="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_TELEPHONE="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_MEASUREMENT="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_IDENTIFICATION="en_US.utf8"</tt><tt><br>
                </tt><tt>LC_ALL=</tt><br>
                <br>
                any ideas for the Linux platform?<span class="gmail-"><br>
                  <br>
                </span></div>
            </blockquote>
            <div>Hum, I tried your example, the problem is that <span
                style="font-family:monospace;font-size:10.4px">${CMAKE_BUILD_DIRECTORY}/testing
                i</span>s missing a main.c file. If I create a fake file
              and the coverage reports 100%. I've Cc Brad King since He
              is most familiar with Ninja related issues.</div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <div bgcolor="#FFFFFF"><span class="gmail-"> <br>
                  <div class="gmail-m_5463440942134228422moz-signature">mit
                    freundlichen Grüßen / best regards<br>
                    <br>
                    <b>Gerhard Gappmeier</b><br>
                    ascolab GmbH - automation systems communication
                    laboratory<br>
                    Tel.: <a href="tel:+49%20911%20569846203"
                      value="+49911569846203" target="_blank"
                      moz-do-not-send="true">+49 911 569846 203</a><br>
                    Fax: <a href="tel:+49%20911%20569846400"
                      value="+49911569846400" target="_blank"
                      moz-do-not-send="true">+49 911 569846 400</a><br>
                    Web: <a
                      class="gmail-m_5463440942134228422moz-txt-link-freetext"
                      href="http://www.ascolab.com" target="_blank"
                      moz-do-not-send="true">http://www.ascolab.com</a><br>
                    GPG-KeyId: 7A78B0A7 <br>
                    GPG-Fingerprint: A964 56A2 32E9 A537 AB7E EBD6 8D09
                    0D72 7A78 B0A7<br>
                    <p style="font-family:helvetica;font-size:8pt"> --<br>
                      <b>ascolab GmbH</b><br>
                      Geschäftsführer: Gerhard Gappmeier, Matthias Damm,
                      Uwe Steinkrauß<br>
                      Sitz der Gesellschaft: An der Kaufleite 34 • 90562
                      Kalchreuth • Germany<br>
                      Registernummer: HRB 9360<br>
                      Registergericht: Amtsgericht Fürth<br>
                    </p>
                  </div>
                </span>
                <div class="gmail-m_5463440942134228422moz-cite-prefix">On
                  09/01/2017 02:49 PM, Haocheng Liu wrote:<br>
                </div>
                <blockquote type="cite"><span>chcp 65001</span></blockquote>
                <br>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature">
            <div dir="ltr">
              <div>
                <div dir="ltr">Best regards
                  <div>Haocheng</div>
                  <div><br>
                  </div>
                  <div>Haocheng LIU</div>
                  <div><span style="color:rgb(0,0,0);font-size:12.8px">Kitware,
                      Inc.</span><br
                      style="color:rgb(0,0,0);font-size:12.8px">
                    <span style="color:rgb(0,0,0);font-size:12.8px">R&D
                      Engineer</span><br
                      style="color:rgb(0,0,0);font-size:12.8px">
                    <span style="color:rgb(0,0,0);font-size:12.8px">21
                      Corporate Drive</span><br
                      style="color:rgb(0,0,0);font-size:12.8px">
                    <span style="color:rgb(0,0,0);font-size:12.8px">Clifton
                      Park, NY 12065-8662</span><br
                      style="color:rgb(0,0,0);font-size:12.8px">
                    <span style="color:rgb(0,0,0);font-size:12.8px">Phone: </span><a
                      href="tel:%28518%29%20881-4421"
                      value="+15188814443"
                      style="color:rgb(17,85,204);font-size:12.8px"
                      target="_blank" moz-do-not-send="true">518-881-4421</a><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>