Commit a9fb2231c859d1da156af1052a1220fa447482ef
Committed by
Moritz Wirger
1 parent
c29dd463
Add sources directly for coverage test, so cpp files are included.
Showing
2 changed files
with
8 additions
and
2 deletions
src/CMakeLists.txt
| @@ -37,6 +37,12 @@ if(ESP_PLATFORM) | @@ -37,6 +37,12 @@ if(ESP_PLATFORM) | ||
| 37 | ) | 37 | ) |
| 38 | endif() | 38 | endif() |
| 39 | 39 | ||
| 40 | +# append current source dir before files | ||
| 41 | +foreach(src ${hueplusplus_SOURCES}) | ||
| 42 | + list(APPEND _srcList "${CMAKE_CURRENT_SOURCE_DIR}/${src}") | ||
| 43 | +endforeach() | ||
| 44 | +set(hueplusplus_SOURCES ${_srcList} PARENT_SCOPE) | ||
| 45 | + | ||
| 40 | # hueplusplus shared library | 46 | # hueplusplus shared library |
| 41 | add_library(hueplusplusshared SHARED ${hueplusplus_SOURCES}) | 47 | add_library(hueplusplusshared SHARED ${hueplusplus_SOURCES}) |
| 42 | target_compile_features(hueplusplusshared PUBLIC cxx_std_14) | 48 | target_compile_features(hueplusplusshared PUBLIC cxx_std_14) |
test/CMakeLists.txt
| @@ -76,11 +76,11 @@ mark_as_advanced(LCOV_PATH) | @@ -76,11 +76,11 @@ mark_as_advanced(LCOV_PATH) | ||
| 76 | if(LCOV_PATH AND GCOV_PATH) | 76 | if(LCOV_PATH AND GCOV_PATH) |
| 77 | # GCov | 77 | # GCov |
| 78 | include(CodeCoverage.cmake) | 78 | include(CodeCoverage.cmake) |
| 79 | - add_executable(testcov_HuePlusPlus ${TEST_SOURCES}) | 79 | + add_executable(testcov_HuePlusPlus ${TEST_SOURCES} ${hueplusplus_SOURCES}) |
| 80 | + target_include_directories(testcov_HuePlusPlus PUBLIC "${PROJECT_SOURCE_DIR}/include") | ||
| 80 | target_compile_features(testcov_HuePlusPlus PUBLIC cxx_std_14) | 81 | target_compile_features(testcov_HuePlusPlus PUBLIC cxx_std_14) |
| 81 | set_property(TARGET testcov_HuePlusPlus PROPERTY CXX_EXTENSIONS OFF) | 82 | set_property(TARGET testcov_HuePlusPlus PROPERTY CXX_EXTENSIONS OFF) |
| 82 | 83 | ||
| 83 | - target_link_libraries(testcov_HuePlusPlus PUBLIC hueplusplusstatic) | ||
| 84 | target_link_libraries(testcov_HuePlusPlus PUBLIC gtest gmock) | 84 | target_link_libraries(testcov_HuePlusPlus PUBLIC gtest gmock) |
| 85 | target_include_directories(testcov_HuePlusPlus PUBLIC ${GTest_INCLUDE_DIRS}) | 85 | target_include_directories(testcov_HuePlusPlus PUBLIC ${GTest_INCLUDE_DIRS}) |
| 86 | # this will be already done by APPEND_COVERAGE_COMPILER_FLAGS() | 86 | # this will be already done by APPEND_COVERAGE_COMPILER_FLAGS() |