gnucash/libgnucash/gnc-module/CMakeLists.txt
John Ralls 6834cb5025 Implement coverage option
To use pass -DCMAKE_BUILD_TYPE=Debug or Asan -DCOVERAGE=ON and build as
usual, then do ninja lcov-initialize && ninja check && ninja
lcov-collect. The result will be a directory, <Builddir>/Coverage
containing lcov tracefiles, including an aggregate file gnucash.info
which you can use for further processing. It will also report an overall summary.
Note that only C/C++ files are included.

There's one more target, lcov-generate-html, that you can run after
lcov-collect. It will generate a simple website in
<Builddir>/Coverage-HTML showing coverage by source directory (the
directories in <Builddir> have coverage for generated files). Each
directory path is a clickable link to a page that shows coverage for
each source file; the filenames link to a page for each showing which
lines have been exercised.
2023-12-08 14:53:02 -08:00

44 lines
1.2 KiB
CMake

# CMakeLists.txt for libgnucash/gnc-module
add_subdirectory(test)
add_subdirectory(example)
set (gnc_module_SOURCES gnc-module.c)
# Add dependency on config.h
set_source_files_properties (${gnc_module_SOURCES} PROPERTIES OBJECT_DEPENDS ${CONFIG_H})
set (gnc_module_HEADERS
gnc-module.h
gnc-module-api.h
)
add_library (gnc-module
${gnc_module_SOURCES}
${gnc_module_HEADERS}
)
target_link_libraries(gnc-module ${GMODULE_LDFLAGS} PkgConfig::GLIB2)
target_compile_definitions (gnc-module PRIVATE -DG_LOG_DOMAIN=\"gnc.module\")
target_include_directories (gnc-module
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/common
${CMAKE_BINARY_DIR}/common # for config.h
)
if (COVERAGE)
add_coverage_target(gnc-module)
endif()
install(TARGETS gnc-module
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${gnc_module_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gnucash)
set_local_dist(gnc_module_DIST_local CMakeLists.txt ${gnc_module_SOURCES} ${gnc_module_HEADERS}
README)
set(gnc_module_DIST ${gnc_module_DIST_local} ${test_gnc_module_DIST} ${example_DIST} PARENT_SCOPE)