mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-01 11:17:36 +02:00
Add WERROR option to cmake
This commit is contained in:
parent
aab3c343d0
commit
b7c69ab85a
4 changed files with 13 additions and 6 deletions
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
|
@ -30,6 +30,6 @@ jobs:
|
||||||
#- name: ccache dump config
|
#- name: ccache dump config
|
||||||
# run: ccache -p
|
# run: ccache -p
|
||||||
- name: cmake build
|
- name: cmake build
|
||||||
run: cmake -S . -B build -DBOOST_ROOT=boost_1_74_0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS="-I/usr/local/include"
|
run: cmake -S . -B build -DBOOST_ROOT=boost_1_74_0 -DCMAKE_BUILD_TYPE=Release -DWERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS="-I/usr/local/include"
|
||||||
- name: cmake make
|
- name: cmake make
|
||||||
run: cmake --build build --parallel 3
|
run: cmake --build build --parallel 3
|
||||||
|
|
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
||||||
#- name: ccache dump config
|
#- name: ccache dump config
|
||||||
# run: ccache -p
|
# run: ccache -p
|
||||||
- name: cmake build
|
- name: cmake build
|
||||||
run: cmake -S . -B build -DBOOST_ROOT=boost_1_74_0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
run: cmake -S . -B build -DBOOST_ROOT=boost_1_74_0 -DCMAKE_BUILD_TYPE=Release -DWERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
- name: cmake make
|
- name: cmake make
|
||||||
run: cmake --build build --parallel 3
|
run: cmake --build build --parallel 3
|
||||||
- name: debian package
|
- name: debian package
|
||||||
|
|
|
@ -199,9 +199,9 @@ script:
|
||||||
- |
|
- |
|
||||||
(
|
(
|
||||||
if [ "$TRAVIS_OS_NAME" != 'windows' ]; then
|
if [ "$TRAVIS_OS_NAME" != 'windows' ]; then
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release .. && make && sudo make install
|
cmake -DCMAKE_BUILD_TYPE=Release -DWERROR=ON .. && make && sudo make install
|
||||||
else
|
else
|
||||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
|
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Release -DWERROR=ON ..
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,15 +7,22 @@ set(PROJECT_URL "https://github.com/badaix/snapcast")
|
||||||
option(BUILD_SHARED_LIBS "Build snapcast in a shared context" ON)
|
option(BUILD_SHARED_LIBS "Build snapcast in a shared context" ON)
|
||||||
option(BUILD_STATIC_LIBS "Build snapcast in a static context" ON)
|
option(BUILD_STATIC_LIBS "Build snapcast in a static context" ON)
|
||||||
option(BUILD_TESTS "Build tests (run tests with make test)" ON)
|
option(BUILD_TESTS "Build tests (run tests with make test)" ON)
|
||||||
|
option(WERROR "Treat warnings as errors" OFF)
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# warning level 4 and all warnings as errors
|
# warning level 4 and all warnings as errors
|
||||||
# warning C4505: 'getArch': unreferenced local function has been removed
|
# warning C4505: 'getArch': unreferenced local function has been removed
|
||||||
# warning C4458: declaration of 'size' hides class member
|
# warning C4458: declaration of 'size' hides class member
|
||||||
add_compile_options(/W4 /WX /wd4458 /wd4505)
|
add_compile_options(/W4 /wd4458 /wd4505)
|
||||||
|
if (WERROR)
|
||||||
|
add_compile_options(/WX)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
# lots of warnings and all warnings as errors
|
# lots of warnings and all warnings as errors
|
||||||
add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-unused-function)
|
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-function)
|
||||||
|
if (WERROR)
|
||||||
|
add_compile_options(-Werror)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
Loading…
Add table
Reference in a new issue