mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-26 15:40:41 +00:00
cmake: Silence warnings with clang.
This commit is contained in:
parent
c008a5d523
commit
0c05ad471c
@ -81,16 +81,13 @@ endif()
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-Wall" COMPILER_SUPPORTS_WALL)
|
||||
if(COMPILER_SUPPORTS_WALL)
|
||||
message("Enabling -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
endif()
|
||||
include(CheckCXXFlag)
|
||||
check_cxx_flag(-Wall COMPILER_SUPPORTS_WALL)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-switch")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
|
||||
if(NOT ANDROID)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess -Wno-invalid-offsetof")
|
||||
check_cxx_flag(-Wno-class-memaccess COMPILER_SUPPORTS_MEMACCESS)
|
||||
check_cxx_flag(-Wno-invalid-offsetof COMPILER_SUPPORTS_OFFSETOF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
8
CMakeModules/CheckCXXFlag.cmake
Normal file
8
CMakeModules/CheckCXXFlag.cmake
Normal file
@ -0,0 +1,8 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
function(check_cxx_flag flag var)
|
||||
CHECK_CXX_COMPILER_FLAG("-Werror ${flag}" ${var})
|
||||
if(${var})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
Loading…
Reference in New Issue
Block a user