CMake Gcov c++ creating wrong .gcno files
<p>I have a CMakeLists.txt file in which I added:</p>

<pre><code>set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage -pthread -std=c++11 -O0 ${CMAKE_CXX_FLAGS}")
</code></pre>

<p>It is generating the report files in:</p>

<pre><code>project_root/build/CMakeFiles/project.dir/
</code></pre>

<p>BUT the files it generates have extentions <code>.cpp.gcno</code>, <code>.cpp.gcda</code> and <code>.cpp.o</code>.</p>

<p>Also, they are not in the same folder as the src files, which are at:</p>

<pre><code>project_root/src/ 
</code></pre>

<p>When I move the report files to the src/ folder and execute</p>

<pre><code>$ gcov main.cpp
main.gcno:cannot open notes file
</code></pre>

<p>But I get that error message. So I change the <code>.cpp.gcno</code>, <code>.cpp.cdna</code> and <code>cpp.o</code> to <code>.gcno</code>, <code>.gcda</code> and <code>.o</code> and finally I get the following:</p>

<pre><code>gcov main.cpp
Lines executed:86.67% of 15
Creating 'main.cpp.gcov'
</code></pre>

<p>I have over 50 files and can't do this manually for each one.</p>

<p>I need to be able to run gcov once for all files and generate report for all files. I don't care where the files are generated.</p>