From 236ea073a9120554825544c8dc1a08914ad6698d Mon Sep 17 00:00:00 2001 From: sumedhghaisas Date: Mon, 27 Jun 2016 02:31:48 -0700 Subject: [PATCH] Making 'lcov' optional. * lcov will only be needed for local coverage report generation --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84ca9ecb878..4c0a3322cb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,16 +86,17 @@ if(BUILD_WITH_COVERAGE) message(FATAL_ERROR "gcov not found! Aborting...") endif() - if(NOT LCOV) - message(FATAL_ERROR "lcov not found! Aborting...") - endif() - - configure_file(CMake/mlpack_coverage.in mlpack_coverage) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fno-inline -fno-inline-small-functions -fno-default-inline -fprofile-arcs -fkeep-inline-functions") message(WARNING "Adding debug options for coverage") # Remove optimizations for better line coverage set(DEBUG ON) - add_custom_target(mlpack_coverage DEPENDS mlpack_test COMMAND ${PROJECT_BINARY_DIR}/mlpack_coverage) + + if(LCOV) + configure_file(CMake/mlpack_coverage.in mlpack_coverage) + add_custom_target(mlpack_coverage DEPENDS mlpack_test COMMAND ${PROJECT_BINARY_DIR}/mlpack_coverage) + else() + message(WARNING "'lcov' not found, local coverage report is disabled. Install 'lcov' and rerun cmake to generate local coverage report.") + endif() else() message(FATAL_ERROR "Coverage will only work with GNU environment.") endif()