Revert "Revert "add an option to enable warnings as errors""

This reverts commit 6db8cfba86.
This commit is contained in:
Charles Giessen 2021-04-18 14:09:32 -06:00
parent 523e76144d
commit 59a8965e15
2 changed files with 14 additions and 4 deletions

View File

@ -54,7 +54,7 @@ jobs:
sudo apt-get install -y vulkan-headers libvulkan-dev xorg-dev
- name: CMake Configure
run: cmake -Bbuild -DVK_BOOTSTRAP_TEST=ON -DCMAKE_BUILD_TYPE=Debug
run: cmake -Bbuild -DVK_BOOTSTRAP_WERROR=ON -DVK_BOOTSTRAP_TEST=ON -DCMAKE_BUILD_TYPE=Debug
- name: CMake Build
run: cmake --build build
@ -79,7 +79,7 @@ jobs:
echo "VULKAN_SDK=./Vulkan-Headers" >> $GITHUB_ENV
- name: CMake Configure
run: cmake -Bbuild -DVK_BOOTSTRAP_TEST=ON -DCMAKE_BUILD_TYPE=Debug
run: cmake -Bbuild -DVK_BOOTSTRAP_WERROR=ON -DVK_BOOTSTRAP_TEST=ON -DCMAKE_BUILD_TYPE=Debug
- name: CMake Build
run: cmake --build build

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(VulkanBootstrap)
option(VK_BOOTSTRAP_WERROR "Enable warnings as errors during compilation" OFF)
add_library(vk-boostrap-vulkan-headers INTERFACE)
set(VK_BOOTSTRAP_VULKAN_HEADER_DIR "" CACHE STRING "Specify the location of the Vulkan-Headers include directory.")
@ -43,14 +45,22 @@ target_compile_options(vk-bootstrap-compiler-warnings
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>,${VK_BOOTSTRAP_COMPILER_CLANGPP}>:
-Wall
-Wextra
-pedantic-errors
-Wconversion
-Wsign-conversion>
$<$<CXX_COMPILER_ID:MSVC>:
/WX
/W4>
)
if(VK_BOOTSTRAP_WERROR)
target_compile_options(vk-bootstrap-compiler-warnings
INTERFACE
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>,${VK_BOOTSTRAP_COMPILER_CLANGPP}>:
-pedantic-errors>
$<$<CXX_COMPILER_ID:MSVC>:
/WX>
)
endif()
target_include_directories(vk-bootstrap PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>)