diff --git a/CMakeLists.txt b/CMakeLists.txt index 550b92aac4..bdb24b8a15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,15 @@ if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE) message(STATUS "set build type to ${CMAKE_BUILD_TYPE}") endif() + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile") option(SUPPORT_STDIOSTREAM - "If enabled provides support for << operator (as used with - std::cout)" OFF) - option(TESTING "Enable testing" OFF) + "If enabled provides support for << operator (as used with std::cout)" OFF) +option(TESTING "Enable testing" OFF) option(FORMAT "Enable formatting" OFF) +option(COV_HTML "Display html for coverage" OFF) if(SUPPORT_STDIOSTREAM) add_definitions(-DSUPPORT_STDIOSTREAM) @@ -56,8 +57,6 @@ set(CMAKE_CXX_FLAGS ) string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -enable_testing() - include_directories(${CMAKE_SOURCE_DIR}) file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp) @@ -96,3 +95,5 @@ set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) set(CPACK_PACKAGE_CONTACT "james.goppert@gmail.com") include(CPack) + +# vim: set noet fenc=utf-8 ft=cmake ff=unix sts=0 sw=4 ts=4 : diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 834ba1359d..da5e6316b2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,13 +27,30 @@ foreach(test_name ${tests}) endforeach() if (${CMAKE_BUILD_TYPE} STREQUAL "Profile") - add_custom_target(coverage + + add_custom_target(coverage_build COMMAND ${CMAKE_CTEST_COMMAND} COMMAND lcov --capture --directory . --output-file coverage.info COMMAND lcov --summary coverage.info - COMMAND genhtml coverage.info --output-directory out - COMMAND x-www-browser out/index.html WORKING_DIRECTORY ${CMAKE_BUILD_DIR} DEPENDS test_build ) + + add_custom_target(coverage_html + COMMAND genhtml coverage.info --output-directory out + COMMAND x-www-browser out/index.html + WORKING_DIRECTORY ${CMAKE_BUILD_DIR} + DEPENDS coverage_build + ) + + set(coverage_deps + coverage_build) + + if (COV_HTML) + list(APPEND coverage_deps coverage_html) + endif() + + add_custom_target(coverage + DEPENDS ${coverage_deps} + ) endif()