Skip to content

Commit

Permalink
cmake: add default Werror, extract version only from GITHUB_REF if tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Kola50011 committed Sep 25, 2024
1 parent 3ac90c3 commit e51895f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_FLAGS="-Werror"
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ project(
VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH}
)

add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Werror)

set(PACKAGE_VERSION ${TAG_VERSION_MAJOR}.${TAG_VERSION_MINOR}.${TAG_VERSION_PATCH})

Expand Down
2 changes: 1 addition & 1 deletion cmake/Versioning.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(GIT_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if(DEFINED ENV{GITHUB_REF})
if(DEFINED ENV{GITHUB_REF} AND ENV{GITHUB_REF_TYPE} EQUAL "tag")
set(TAG_VERSION $ENV{GITHUB_REF})
message(STATUS "Extracted version from GITHUB_REF")
endif()
Expand Down

0 comments on commit e51895f

Please sign in to comment.