diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cb0cce1..7d2726b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,14 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) option(ENABLE_TESTS "Enable all tests and checks" OFF) +option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF) + +if(ENABLE_COVERAGE) + set(ENABLE_TESTS ON) + set(CMAKE_BUILD_TYPE "Coverage") +else() + set(CMAKE_BUILD_TYPE "Release") +endif() # Check for prerequisites diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1ecf8e6..69bc291 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,9 @@ target_include_directories("gtest-menuitems" PUBLIC "${CMAKE_SOURCE_DIR}/src") add_test("gtest-menuitems" "gtest-menuitems") target_link_libraries("gtest-menuitems" ${PROJECT_DEPS_LIBRARIES} "-L${CMAKE_BINARY_DIR}/src" -layatana-ido3-0.4 gtest_main) -# coverage -find_package(CoverageReport) -ENABLE_COVERAGE_REPORT(TARGETS "gtest-menuitems" TESTS "gtest-menuitems") +# coverage +if (ENABLE_COVERAGE) + find_package(CoverageReport) + ENABLE_COVERAGE_REPORT(TARGETS "gtest-menuitems" TESTS "gtest-menuitems") +endif() |