CMake: try to match Clang warning options when building with clang-cl on Windows
Change-Id: I24d6201adfd356f791458393d69be0b088814a0f Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49320 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
4c0b7807f8
commit
5bdece5583
|
@ -155,11 +155,7 @@ function(tint_default_compile_options TARGET)
|
||||||
target_compile_definitions(${TARGET} PUBLIC
|
target_compile_definitions(${TARGET} PUBLIC
|
||||||
-DTINT_BUILD_WGSL_WRITER=$<BOOL:${TINT_BUILD_WGSL_WRITER}>)
|
-DTINT_BUILD_WGSL_WRITER=$<BOOL:${TINT_BUILD_WGSL_WRITER}>)
|
||||||
|
|
||||||
if (${COMPILER_IS_LIKE_GNU})
|
set(COMMON_GNU_OPTIONS
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-std=c++14
|
|
||||||
-fno-exceptions
|
|
||||||
-fno-rtti
|
|
||||||
-Wall
|
-Wall
|
||||||
-Werror
|
-Werror
|
||||||
-Wextra
|
-Wextra
|
||||||
|
@ -167,12 +163,9 @@ function(tint_default_compile_options TARGET)
|
||||||
-Wno-padded
|
-Wno-padded
|
||||||
-Wno-switch-enum
|
-Wno-switch-enum
|
||||||
-Wno-unknown-pragmas
|
-Wno-unknown-pragmas
|
||||||
-pedantic-errors
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR
|
set(COMMON_CLANG_OPTIONS
|
||||||
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
|
|
||||||
target_compile_options(${TARGET} PRIVATE
|
|
||||||
-Wno-c++98-compat
|
-Wno-c++98-compat
|
||||||
-Wno-c++98-compat-pedantic
|
-Wno-c++98-compat-pedantic
|
||||||
-Wno-format-pedantic
|
-Wno-format-pedantic
|
||||||
|
@ -182,6 +175,21 @@ function(tint_default_compile_options TARGET)
|
||||||
-Wno-used-but-marked-unused
|
-Wno-used-but-marked-unused
|
||||||
-Weverything
|
-Weverything
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (${COMPILER_IS_LIKE_GNU})
|
||||||
|
target_compile_options(${TARGET} PRIVATE
|
||||||
|
-std=c++14
|
||||||
|
-fno-exceptions
|
||||||
|
-fno-rtti
|
||||||
|
-pedantic-errors
|
||||||
|
${COMMON_GNU_OPTIONS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR
|
||||||
|
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
|
||||||
|
target_compile_options(${TARGET} PRIVATE
|
||||||
|
${COMMON_CLANG_OPTIONS}
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${TINT_ENABLE_MSAN})
|
if (${TINT_ENABLE_MSAN})
|
||||||
|
@ -231,6 +239,20 @@ function(tint_default_compile_options TARGET)
|
||||||
/wd5026
|
/wd5026
|
||||||
/wd5027
|
/wd5027
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# When building with clang-cl on Windows, try to match our clang build
|
||||||
|
# options as much as possible.
|
||||||
|
if (COMPILER_IS_CLANG_CL)
|
||||||
|
target_compile_options(${TARGET} PRIVATE
|
||||||
|
${COMMON_GNU_OPTIONS}
|
||||||
|
${COMMON_CLANG_OPTIONS}
|
||||||
|
# Disable warnings that are usually disabled in downstream deps for
|
||||||
|
# gcc/clang, but aren't for clang-cl.
|
||||||
|
-Wno-global-constructors
|
||||||
|
-Wno-zero-as-null-pointer-constant
|
||||||
|
-Wno-shorten-64-to-32
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
Loading…
Reference in New Issue