mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-21 02:51:21 +00:00
run additional-flags-usage
job on both GCC and MSVC
This commit is contained in:
parent
657a82ee9f
commit
250f59da81
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
@ -40,7 +40,10 @@ jobs:
|
||||
run: test ! -d build
|
||||
|
||||
additional-flags-usage:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [gcc, msvc]
|
||||
steps:
|
||||
- name: Check out this repository
|
||||
uses: actions/checkout@v3.3.0
|
||||
@ -50,8 +53,8 @@ jobs:
|
||||
with:
|
||||
source-dir: test
|
||||
targets: test_c test_cpp
|
||||
c-flags: -Wno-unused-variable
|
||||
cxx-flags: -Wno-unused-variable
|
||||
c-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
|
||||
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
|
||||
args: -D CHECK_SURPASS_WARNING=ON
|
||||
|
||||
- name: Run the build results
|
||||
|
@ -5,8 +5,13 @@ option(CHECK_USING_CLANG "check if target is compiled using Clang" OFF)
|
||||
option(CHECK_SURPASS_WARNING "check if target could surpass a compiler warning" OFF)
|
||||
|
||||
if(CHECK_SURPASS_WARNING)
|
||||
set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}")
|
||||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS "/WX /W4 ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "/WX /W4 ${CMAKE_CXX_FLAGS}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(hello_world hello_world.cpp)
|
||||
|
Loading…
Reference in New Issue
Block a user