<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 "Enable Testing?")</div><div>SET (DO_CODE_COVERAGE false CACHE BOOL "Enable Code coverage?")</div>
<div><br></div><div>if(DO_CODE_COVERAGE)</div><div><span class="" style="white-space:pre">                </span>MESSAGE (STATUS "Code coverage is enabled")<br></div><div><span class="" style="white-space:pre">                </span>SET(CMAKE_CXX_FLAGS="-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")</div>
<div><span class="" style="white-space:pre">                </span>SET(CMAKE_C_FLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")</div><div><span class="" style="white-space:pre">                </span>SET(CMAKE_SHARED_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")</div>
<div><span class="" style="white-space:pre">                </span>SET(CMAKE_EXE_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")</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 "Testing is enabled")</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("Yes code coverage in test")</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>