Skip to content

Commit

Permalink
cmake: enable -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
marckleinebudde committed May 28, 2024
1 parent ae76dd3 commit a4d6e95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
- name: Configure & Build with gcc
run: |
podman exec -i stable rm -rf build
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -B build
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DENABLE_WERROR=ON -B build
podman exec -i stable cmake --build build
- name: Configure & Build with clang
run: |
podman exec -i stable rm -rf build
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -B build
podman exec -i stable cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DENABLE_WERROR=ON -B build
podman exec -i stable cmake --build build
- name: Show logs
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

# Add an option to enable treating warnings as errors
option(ENABLE_WERROR "Treat all compiler warnings as errors" OFF)

if(ENABLE_WERROR)
add_compile_options(-Werror)
endif()

add_definitions(-D_GNU_SOURCE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
Expand Down

0 comments on commit a4d6e95

Please sign in to comment.