add cmake options to hide warnings if is not main project

This commit is contained in:
Dani Camba 2023-02-15 17:55:36 +01:00 committed by Charles Giessen
parent 8e61b2d81c
commit a5036f2368

View File

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(VulkanBootstrap) project(VulkanBootstrap)
option(VK_BOOTSTRAP_DISABLE_WARNINGS "Enable warnings as errors during compilation" OFF)
option(VK_BOOTSTRAP_WERROR "Enable warnings as errors during compilation" OFF) option(VK_BOOTSTRAP_WERROR "Enable warnings as errors during compilation" OFF)
add_library(vk-bootstrap-vulkan-headers INTERFACE) add_library(vk-bootstrap-vulkan-headers INTERFACE)
@ -42,6 +43,7 @@ else()
set(VK_BOOTSTRAP_COMPILER_CLANGPP 0) set(VK_BOOTSTRAP_COMPILER_CLANGPP 0)
endif() endif()
if(NOT VK_BOOTSTRAP_DISABLE_WARNINGS)
target_compile_options(vk-bootstrap-compiler-warnings target_compile_options(vk-bootstrap-compiler-warnings
INTERFACE INTERFACE
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>,${VK_BOOTSTRAP_COMPILER_CLANGPP}>: $<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>,${VK_BOOTSTRAP_COMPILER_CLANGPP}>:
@ -62,6 +64,7 @@ if(VK_BOOTSTRAP_WERROR)
/WX> /WX>
) )
endif() endif()
endif()
target_include_directories(vk-bootstrap PUBLIC target_include_directories(vk-bootstrap PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>