Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,46 @@ jobs:
run: |
cmake --build cmake.output --target install

- name: Run CMake on ubuntu (no CLI)
if: matrix.os == 'ubuntu-22.04'
run: |
cmake -S . -B cmake.output_nocli -G "Unix Makefiles" -DBUILD_CLI=Off

- name: Run CMake on ubuntu (no CLI / with tests)
if: matrix.os == 'ubuntu-22.04'
run: |
# the test and CLI code are too intertwined so for now we need to reject that
if cmake -S . -B cmake.output_nocli_tests -G "Unix Makefiles" -DBUILD_TESTS=On -DBUILD_CLI=Off; then
exit 1
else
exit 0
fi

- name: Run CMake on ubuntu (no CLI / with GUI)
if: matrix.os == 'ubuntu-22.04'
run: |
cmake -S . -B cmake.output_nocli_gui -G "Unix Makefiles" -DBUILD_CLI=Off -DBUILD_GUI=On

- name: Run CMake on ubuntu (no GUI)
if: matrix.os == 'ubuntu-22.04'
run: |
cmake -S . -B cmake.output_nogui -G "Unix Makefiles" -DBUILD_GUI=Off

- name: Run CMake on ubuntu (no GUI / with triage)
if: matrix.os == 'ubuntu-22.04'
run: |
# cannot build triage without GUI
if cmake -S . -B cmake.output_nogui_triage -G "Unix Makefiles" -DBUILD_GUI=Off -DBUILD_TRIAGE=On; then
exit 1
else
exit 0
fi

- name: Run CMake on ubuntu (no CLI / no GUI)
if: matrix.os == 'ubuntu-22.04'
run: |
cmake -S . -B cmake.output_nocli_nogui -G "Unix Makefiles" -DBUILD_GUI=Off

build_uchar:

strategy:
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/selfcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ jobs:
UNUSEDFUNCTION_ONLY: 1
# unusedFunction notest nocli - end

# unusedFunction notest nocli nogui - start
- name: CMake (no test / no cli / no gui)
run: |
cmake -S . -B cmake.output.notest_nocli_nogui -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=Off -DBUILD_CLI=Off -DBUILD_GUI=Off -DENABLE_CHECK_INTERNAL=On

- name: Generate dependencies (no test / no cli / no gui)
run: |
# make sure the precompiled headers exist
make -C cmake.output.notest_nocli_nogui lib/CMakeFiles/cppcheck-core.dir/cmake_pch.hxx.cxx

# TODO: find a way to report unmatched suppressions without need to add information checks
- name: Self check (unusedFunction / no test / no cli / no gui)
if: false # TODO: the findings are currently too intrusive
run: |
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest_nocli_nogui/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
env:
DISABLE_VALUEFLOW: 1
UNUSEDFUNCTION_ONLY: 1
# unusedFunction notest nocli nogui - end

- name: Fetch corpus
run: |
wget https://github.com/danmar/cppcheck/archive/refs/tags/2.8.tar.gz
Expand Down
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ if(LIBXML2_XMLLINT_EXECUTABLE)
add_dependencies(validatePlatforms validatePlatforms-${platformname})
endforeach()

add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
DEPENDS cppcheck)
if(TARGET cppcheck)
add_custom_target(errorlist-xml $<TARGET_FILE:cppcheck> --errorlist > ${CMAKE_BINARY_DIR}/errorlist.xml
DEPENDS cppcheck)

add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
DEPENDS cppcheck)
add_custom_target(example-xml $<TARGET_FILE:cppcheck> --xml --enable=all --inconclusive --max-configs=1 ${CMAKE_SOURCE_DIR}/samples 2> ${CMAKE_BINARY_DIR}/example.xml
DEPENDS cppcheck)
endif()

add_custom_target(createXMLExamples DEPENDS errorlist-xml example-xml)

Expand Down
5 changes: 4 additions & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ option(ENABLE_CHECK_INTERNAL "Enable internal checks"
option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF)
option(BUILD_MANPAGE "Enable man target to build manpage" OFF)

option(BUILD_CLI "Build the cli application" ON)
option(BUILD_CLI "Build the CLI application" ON)
if(NOT BUILD_CLI AND BUILD_TESTS)
message(FATAL_ERROR "Building the tests requires the CLI to be build as well")
endif()
Comment on lines +66 to +68
Copy link
Copy Markdown
Collaborator Author

@firewave firewave Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI and test code are simply to intertwined to be separated so reject this combination for now.


option(BUILD_GUI "Build the qt application" OFF)
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)
Expand Down