mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-21 19:11: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
|
run: test ! -d build
|
||||||
|
|
||||||
additional-flags-usage:
|
additional-flags-usage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.compiler == 'msvc' && 'windows' || 'ubuntu' }}-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
compiler: [gcc, msvc]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out this repository
|
- name: Check out this repository
|
||||||
uses: actions/checkout@v3.3.0
|
uses: actions/checkout@v3.3.0
|
||||||
@ -50,8 +53,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
source-dir: test
|
source-dir: test
|
||||||
targets: test_c test_cpp
|
targets: test_c test_cpp
|
||||||
c-flags: -Wno-unused-variable
|
c-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
|
||||||
cxx-flags: -Wno-unused-variable
|
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w' || '-Wno-unused-variable' }}
|
||||||
args: -D CHECK_SURPASS_WARNING=ON
|
args: -D CHECK_SURPASS_WARNING=ON
|
||||||
|
|
||||||
- name: Run the build results
|
- 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)
|
option(CHECK_SURPASS_WARNING "check if target could surpass a compiler warning" OFF)
|
||||||
|
|
||||||
if(CHECK_SURPASS_WARNING)
|
if(CHECK_SURPASS_WARNING)
|
||||||
set(CMAKE_C_FLAGS "-Werror -Wunused-variable ${CMAKE_C_FLAGS}")
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "-Werror -Wunused-variable ${CMAKE_CXX_FLAGS}")
|
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()
|
endif()
|
||||||
|
|
||||||
add_executable(hello_world hello_world.cpp)
|
add_executable(hello_world hello_world.cpp)
|
||||||
|
Loading…
Reference in New Issue
Block a user