Skip to content

Commit b375452

Browse files
committed
cmake: fix code coverage with ENABLE_LAPI_TESTS
Running tests is failed when CMake options `ENABLE_LAPI_TESTS` and `ENABLE_COV` are enabled. The patch enables C/C++ flags related to code coverage for luzer, this prevents an error on loading luzer_impl.so due to undefined symbol `llvm_gcda_summary_info`.
1 parent b2b6fbb commit b375452

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cmake/BuildLuzer.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ list(APPEND LUZER_CMAKE_FLAGS
1717
"-DLUA_INCLUDE_DIR=${LUA_INCLUDE_DIR}"
1818
"-DLUA_LIBRARIES=${LUA_LIBRARIES_LOCATION}"
1919
)
20+
# Prevents an error on loading luzer_impl.so due to undefined
21+
# symbol `llvm_gcda_summary_info`.
22+
if(ENABLE_COV)
23+
list(APPEND COVERAGE_FLAGS
24+
"-fprofile-instr-generate"
25+
"-fprofile-arcs"
26+
"-fcoverage-mapping"
27+
"-ftest-coverage"
28+
)
29+
list(APPEND LUZER_CMAKE_FLAGS
30+
"-DCMAKE_C_FLAGS=${COVERAGE_FLAGS}"
31+
"-DCMAKE_CXX_FLAGS=${COVERAGE_FLAGS}"
32+
)
33+
endif()
2034
if(USE_LUAJIT)
2135
list(APPEND LUZER_CMAKE_FLAGS
2236
"-DLUAJIT_FRIENDLY_MODE=ON"

0 commit comments

Comments
 (0)