<div dir="ltr">Hi,<div><br></div><div style>I am trying cmake in cygwin for code coverage analysis using gcov. My source code is arranged as follows</div><div style><br></div><div style><div>CMakeLists.txt  src  tests<br></div>
<div><br></div><div>./src:</div><div>CMakeLists.txt  lib  main.cpp</div><div><br></div><div>./src/lib:</div><div>reverse</div><div><br></div><div>./src/lib/reverse:</div><div>CMakeLists.txt  reverse.cpp  reverse.h</div><div>
<br></div><div>./tests:</div><div>CMakeLists.txt  test_rev.cpp  test_runner.cpp</div><div><br></div><div><br></div><div><br></div><div style>My main make file is also given below</div><div style><br></div><div style>#Root cmake file<br>
</div><div style><div>cmake_minimum_required (VERSION 2.6)</div><div>PROJECT (Tutorial)</div><div>SET (DO_TEST false CACHE BOOL &quot;Enable Testing?&quot;)</div><div>SET (DO_CODE_COVERAGE false CACHE BOOL &quot;Enable Code coverage?&quot;)</div>
<div><br></div><div>if(DO_CODE_COVERAGE)</div><div><span class="" style="white-space:pre">                </span>MESSAGE (STATUS &quot;Code coverage is enabled&quot;)<br></div><div><span class="" style="white-space:pre">                </span>SET(CMAKE_CXX_FLAGS=&quot;-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage&quot;)</div>
<div><span class="" style="white-space:pre">                </span>SET(CMAKE_C_FLAGS=&quot;-g -O0 -Wall -W -fprofile-arcs -ftest-coverage&quot;)</div><div><span class="" style="white-space:pre">                </span>SET(CMAKE_SHARED_LINKER_FLAGS=&quot;-fprofile-arcs -ftest-coverage&quot;)</div>
<div><span class="" style="white-space:pre">                </span>SET(CMAKE_EXE_LINKER_FLAGS=&quot;-fprofile-arcs -ftest-coverage&quot;)</div><div>endif(DO_CODE_COVERAGE)<br></div><div><br></div><div>ADD_SUBDIRECTORY(src/lib/reverse)</div>
<div>ADD_SUBDIRECTORY(src)</div><div><br></div><div>#Testing related code</div><div>if(DO_TEST)</div><div><span class="" style="white-space:pre">        </span>MESSAGE (STATUS &quot;Testing is enabled&quot;)</div><div><span class="" style="white-space:pre">        </span>ADD_SUBDIRECTORY(tests)</div>
<div><span class="" style="white-space:pre">        </span>#ENABLE_TESTING()</div><div><span class="" style="white-space:pre">        </span>include( CTest )</div><div><span class="" style="white-space:pre">        </span>ADD_TEST(NAME Test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/Debug COMMAND test_rev)</div>
<div>endif(DO_TEST)</div><div><br></div><div style><br></div><div style>And the major portion of the cmake file of test executable is also given below.</div><div style><br></div><div style><br></div><div style><div>#Cmake file of Tests</div>
<div>cmake_minimum_required (VERSION 2.6)</div><div><br></div><div>SET(TST_SRC test_rev.cpp test_runner.cpp)</div><div><br></div><div>FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)</div><div><br></div><div>INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})</div>
<div>INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)</div><div>ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)</div><div>ADD_EXECUTABLE(test_rev ${TST_SRC})</div><div>TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})</div>
<div>TARGET_LINK_LIBRARIES(test_rev Reverse)</div><div>if(DO_CODE_COVERAGE)</div><div><span class="" style="white-space:pre">        </span>MESSAGE(&quot;Yes code coverage in test&quot;)</div><div><span class="" style="white-space:pre">        </span>TARGET_LINK_LIBRARIES(test_rev gcov)</div>
<div>endif(DO_CODE_COVERAGE)</div><div><br></div></div></div><div style>When I run, I get the following error</div><div style><br></div><div>$ make ExperimentalCoverage</div><div>   Site: llvm</div><div>   Build name: CYGWIN-c++.exe</div>
<div>Performing coverage</div><div> Cannot find any coverage files. Ignoring Coverage request.</div><div>Built target ExperimentalCoverage</div><div><br></div><div style>Why is the coverage files are not created? </div><div style>
<br></div><div style>Thanks,</div><div style>  Lloyd</div><div style> </div><div><br></div><div><br></div></div><div style><br></div><div style><br></div></div>