Hi,

I am trying cmake in cygwin for code coverage analysis using gcov. My
source code is arranged as follows

CMakeLists.txt  src  tests

./src:
CMakeLists.txt  lib  main.cpp

./src/lib:
reverse

./src/lib/reverse:
CMakeLists.txt  reverse.cpp  reverse.h

./tests:
CMakeLists.txt  test_rev.cpp  test_runner.cpp



My main make file is also given below

#Root cmake file
cmake_minimum_required (VERSION 2.6)
PROJECT (Tutorial)
SET (DO_TEST false CACHE BOOL "Enable Testing?")
SET (DO_CODE_COVERAGE false CACHE BOOL "Enable Code coverage?")

if(DO_CODE_COVERAGE)
MESSAGE (STATUS "Code coverage is enabled")
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")
SET(CMAKE_C_FLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage")
SET(CMAKE_SHARED_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")
endif(DO_CODE_COVERAGE)

ADD_SUBDIRECTORY(src/lib/reverse)
ADD_SUBDIRECTORY(src)

#Testing related code
if(DO_TEST)
MESSAGE (STATUS "Testing is enabled")
ADD_SUBDIRECTORY(tests)
#ENABLE_TESTING()
include( CTest )
ADD_TEST(NAME Test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/Debug COMMAND
test_rev)
endif(DO_TEST)


And the major portion of the cmake file of test executable is also given
below.


#Cmake file of Tests
cmake_minimum_required (VERSION 2.6)

SET(TST_SRC test_rev.cpp test_runner.cpp)

FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)

INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
ADD_EXECUTABLE(test_rev ${TST_SRC})
TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(test_rev Reverse)
if(DO_CODE_COVERAGE)
MESSAGE("Yes code coverage in test")
TARGET_LINK_LIBRARIES(test_rev gcov)
endif(DO_CODE_COVERAGE)

When I run, I get the following error

$ make ExperimentalCoverage
   Site: llvm
   Build name: CYGWIN-c++.exe
Performing coverage
 Cannot find any coverage files. Ignoring Coverage request.
Built target ExperimentalCoverage

Why is the coverage files are not created?

Thanks,
  Lloyd
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to