From 579c0741ef9ad3ec2f7f0b1afc00f9bf77e6dd3f Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 2 Feb 2017 17:14:30 -0500 Subject: Also need PARENT_SCOPE here. --- CMakeLists.txt | 39 ++++++++++++++++++++++----------------- tests/CMakeLists.txt | 2 +- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f80a129..7e08544 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,28 +110,33 @@ endif() include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories (${CMAKE_CURRENT_BINARY_DIR}/include) -# testing & coverage -if (${ENABLE_TESTS}) - pkg_check_modules (DBUSTEST REQUIRED dbustest-1>=14.04.0) - enable_testing () - if (${ENABLE_COVERAGE}) - find_package(CoverageReport) - ENABLE_COVERAGE_REPORT( - TARGETS indicatordatetimeservice ayatana-indicator-datetime-service - TESTS ${COVERAGE_TEST_TARGETS} - FILTER /usr/include ${CMAKE_BINARY_DIR}/* - ) - endif () -endif () - # actually build things add_subdirectory(include) add_subdirectory(src) add_subdirectory(data) add_subdirectory(po) -if (${ENABLE_TESTS}) - add_subdirectory(tests) -endif () + +# testing & coverage +if (ENABLE_TESTS) + + include(CTest) + pkg_check_modules (DBUSTEST REQUIRED dbustest-1>=14.04.0) + enable_testing () + enable_testing() + add_subdirectory(tests) + + if (ENABLE_COVERAGE) + + find_package(CoverageReport) + ENABLE_COVERAGE_REPORT( + TARGETS indicatordatetimeservice ayatana-indicator-datetime-service + TESTS ${COVERAGE_TEST_TARGETS} + FILTER /usr/include ${CMAKE_BINARY_DIR}/* + ) + + endif() + +endif() # Display config info diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8b80c2e..d83f315 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -108,7 +108,7 @@ add_eds_ics_test_by_name(test-eds-ics-repeating-events-with-individual-change) # which hasn't landed yet. These can be re-enabled as soon as that lands. #function(add_dbusmock_test_by_name name) # set (TEST_NAME ${name}) -# set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME}) +# set (COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE) # add_executable (${TEST_NAME} ${TEST_NAME}.cpp gschemas.compiled) # add_test (${TEST_NAME} ${TEST_NAME}) # target_link_libraries (${TEST_NAME} indicatordatetimeservice ${SERVICE_DEPS_LIBRARIES} ${DBUSTEST_LIBRARIES} ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES}) -- cgit v1.2.3