mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Merge pull request #22 from orbea/clang
cmake: Silence warnings with clang.
This commit is contained in:
commit
9c82096f8f
|
@ -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 a new issue