mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
Fixup Clang on windows support
This commit fixes issues that prevented clang-cl & clang from being distinguished on windows, resulting in improper command line arguments being used. CMAKE_CXX_COMPILER_FRONTEND_VARIANT is the proper way to distinguish clang from clang-cl, which have different command line options.
This commit is contained in:
parent
e2e2d69785
commit
767bd1baf2
@ -26,7 +26,8 @@ if(IS_DIRECTORY ${VK_BOOTSTRAP_VULKAN_HEADER_DIR})
|
|||||||
add_library(Vulkan-Headers INTERFACE)
|
add_library(Vulkan-Headers INTERFACE)
|
||||||
add_library(Vulkan::Headers ALIAS Vulkan-Headers)
|
add_library(Vulkan::Headers ALIAS Vulkan-Headers)
|
||||||
target_include_directories(Vulkan-Headers INTERFACE $<BUILD_INTERFACE:${VK_BOOTSTRAP_VULKAN_HEADER_DIR}>)
|
target_include_directories(Vulkan-Headers INTERFACE $<BUILD_INTERFACE:${VK_BOOTSTRAP_VULKAN_HEADER_DIR}>)
|
||||||
|
# If we had to use a direct path to get the headers, disable installing
|
||||||
|
set(VK_BOOTSTRAP_INSTALL OFF)
|
||||||
# Check if the target is already defined
|
# Check if the target is already defined
|
||||||
elseif(NOT TARGET Vulkan::Headers)
|
elseif(NOT TARGET Vulkan::Headers)
|
||||||
# Try looking for the VulkanHeaders package directly
|
# Try looking for the VulkanHeaders package directly
|
||||||
@ -55,34 +56,22 @@ endif()
|
|||||||
|
|
||||||
add_library(vk-bootstrap-compiler-warnings INTERFACE)
|
add_library(vk-bootstrap-compiler-warnings INTERFACE)
|
||||||
|
|
||||||
# Determine whether we're compiling with clang++
|
set(VK_BOOTSTRAP_COMPILER_FRONTEND ${CMAKE_CXX_COMPILER_FRONTEND_VARIANT})
|
||||||
string(FIND "${CMAKE_CXX_COMPILER}" "clang++" VK_BOOTSTRAP_COMPILER_CLANGPP)
|
if(NOT VK_BOOTSTRAP_COMPILER_FRONTEND)
|
||||||
if(VK_BOOTSTRAP_COMPILER_CLANGPP GREATER -1)
|
set(VK_BOOTSTRAP_COMPILER_FRONTEND "None")
|
||||||
set(VK_BOOTSTRAP_COMPILER_CLANGPP 1)
|
|
||||||
else()
|
|
||||||
set(VK_BOOTSTRAP_COMPILER_CLANGPP 0)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT VK_BOOTSTRAP_DISABLE_WARNINGS)
|
if(NOT VK_BOOTSTRAP_DISABLE_WARNINGS)
|
||||||
target_compile_options(vk-bootstrap-compiler-warnings
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|AppleClang" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND VK_BOOTSTRAP_COMPILER_FRONTEND MATCHES "GNU"))
|
||||||
INTERFACE
|
target_compile_options(vk-bootstrap-compiler-warnings INTERFACE -Wall -Wextra -Wconversion -Wsign-conversion)
|
||||||
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>,${VK_BOOTSTRAP_COMPILER_CLANGPP}>:
|
if(VK_BOOTSTRAP_WERROR)
|
||||||
-Wall
|
target_compile_options(vk-bootstrap-compiler-warnings INTERFACE -pedantic-errors)
|
||||||
-Wextra
|
endif()
|
||||||
-Wconversion
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND VK_BOOTSTRAP_COMPILER_FRONTEND MATCHES "MSVC"))
|
||||||
-Wsign-conversion>
|
target_compile_options(vk-bootstrap-compiler-warnings INTERFACE /W4)
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:
|
if(VK_BOOTSTRAP_WERROR)
|
||||||
/W4>
|
target_compile_options(vk-bootstrap-compiler-warnings INTERFACE /WX)
|
||||||
)
|
endif()
|
||||||
|
|
||||||
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()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user