Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Test the possibility of using problem matchers for errors/warnings #195

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
# has meaningful results
- name: Configure CMake
run: |
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }}
cmake -S . -B ./build -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -DENABLE_DEVELOPER_MODE:BOOL=${{matrix.developer_mode}} -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DOPT_WARNINGS_AS_ERRORS:BOOL=${{ matrix.build_type == 'Debug' }}

- name: Build
# Execute the build. You can specify a specific target with "--target <NAME>"
Expand Down
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
# https://github.com/cpp-best-practices/project_options
include(FetchContent)
FetchContent_Declare(_project_options
URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.15.1.zip)
URL https://github.com/lefticus/project_options/archive/refs/heads/set_cppcheck_template.zip)
FetchContent_MakeAvailable(_project_options)
include(${_project_options_SOURCE_DIR}/Index.cmake)

Expand Down Expand Up @@ -50,9 +50,18 @@ if(BUILDING_MULTI_CONFIG)
endif()
endif()


# Note: by default ENABLE_DEVELOPER_MODE is True
# This means that all analysis (sanitizers, static analysis)
# is enabled and all warnings are treated as errors
# if you want to switch this behavior, uncomment this line:
# set(ENABLE_DEVELOPER_MODE FALSE CACHE BOOL "Enable 'developer mode'")


include(${_project_options_SOURCE_DIR}/src/DynamicProjectOptions.cmake)

# defaulted_project_options sets recommended defaults and provides user and developer

# dynamic_project_options sets recommended defaults and provides user and developer
# modes and full GUI support for choosing options at configure time

# for more flexibility, look into project_options() macro
Expand Down
11 changes: 11 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ int main(int argc, const char **argv)
spdlog::info("Hello, {}!", "World");

fmt::print("Hello, from {}\n", "{fmt}");

// this line exists solely to check the problem matchers
int *i = nullptr;
*i = 42;

int j;
int k;
int l = j + k;

fmt::print("Test printing values {} {} {} {}\n", *i, j, k, l);

} catch (const std::exception &e) {
fmt::print("Unhandled exception in main: {}", e.what());
}
Expand Down