Hi Haocheng, thanks for helping. I guess this has to do with another issue. The Ninja generator generates different paths then the default Unix Makefile generator.
This leads to the following behavior in normal build operations: I introduced a warning in the printf line to demonstrate this. With Makefiles: mkdir bld && cd bld && cmake .. Build inside Vim using ":make" [ 50%] Building C object CMakeFiles/demo.dir/main.c.o /home/gergap/tmp/demo/main.c: In function ‘main’: /home/gergap/tmp/demo/main.c:5:12: warning: format ‘%i’ expects a matching ‘int’ argument [-Wformat=] printf("Hello World %i\n"); ^ [100%] Linking C executable demo [100%] Built target demo Press ENTER or type command to continue as you can see the warning message contains the absolute path, so parsing the errors works for Vim (Emacs, or whatever tool), and you can jump to the error location. Now the same with Ninja: mkdir bld && cd bld && cmake -GNinja .. Build inside Vim using ":make" (use ":set makeprg=ninja" first) cd into build dir '/home/gergap/tmp/demo/bld/../bld'... executing ninja... [1/2] Building C object CMakeFiles/demo.dir/main.c.o ../main.c: In function ‘main’: ../main.c:5:12: warning: format ‘%i’ expects a matching ‘int’ argument [-Wformat=] printf("Hello World %i\n"); ^ [2/2] Linking C executable demo cd back /home/gergap/tmp/demo/bld Press ENTER or type command to continue 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, and this is typically not the case. This is quite annoying, inconsistent with Makefiles and was already reported once here: https://cmake.org/Bug/print_bug_page.php?bug_id=13894 AFAIK this was never fixed. Now I suspect this to be also the reason for the coverage issues. I hope this helps. On 09/01/2017 04:09 PM, Haocheng Liu wrote: > > > On Fri, Sep 1, 2017 at 9:41 AM, Gerhard Gappmeier > <gerhard.gappme...@ascolab.com <mailto:gerhard.gappme...@ascolab.com>> > wrote: > > Hi Haocheng, > > `chcp` seems to be a Windows command. > I'm talking about Linux, which is UTF-8 by default: > > $> locale > LANG=en_US.utf8 > LC_CTYPE="en_US.utf8" > LC_NUMERIC="en_US.utf8" > LC_TIME="en_US.utf8" > LC_COLLATE="en_US.utf8" > LC_MONETARY="en_US.utf8" > LC_MESSAGES="en_US.utf8" > LC_PAPER="en_US.utf8" > LC_NAME="en_US.utf8" > LC_ADDRESS="en_US.utf8" > LC_TELEPHONE="en_US.utf8" > LC_MEASUREMENT="en_US.utf8" > LC_IDENTIFICATION="en_US.utf8" > LC_ALL= > > any ideas for the Linux platform? > > Hum, I tried your example, the problem is > that ${CMAKE_BUILD_DIRECTORY}/testing is 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. > > > mit freundlichen Grüßen / best regards > > *Gerhard Gappmeier* > ascolab GmbH - automation systems communication laboratory > Tel.: +49 911 569846 203 <tel:+49%20911%20569846203> > Fax: +49 911 569846 400 <tel:+49%20911%20569846400> > Web: http://www.ascolab.com > GPG-KeyId: 7A78B0A7 > GPG-Fingerprint: A964 56A2 32E9 A537 AB7E EBD6 8D09 0D72 7A78 B0A7 > > -- > *ascolab GmbH* > Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe Steinkrauß > Sitz der Gesellschaft: An der Kaufleite 34 • 90562 Kalchreuth • > Germany > Registernummer: HRB 9360 > Registergericht: Amtsgericht Fürth > > On 09/01/2017 02:49 PM, Haocheng Liu wrote: >> chcp 65001 > > > > > -- > Best regards > Haocheng > > Haocheng LIU > Kitware, Inc. > R&D Engineer > 21 Corporate Drive > Clifton Park, NY 12065-8662 > Phone: 518-881-4421 <tel:%28518%29%20881-4421>
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake