mirror of https://github.com/mgba-emu/mgba.git
CMake: Fix C standard selection
This commit is contained in:
parent
11ccbca4ff
commit
691c202c40
|
@ -9,14 +9,17 @@ if(POLICY CMP0072)
|
||||||
endif()
|
endif()
|
||||||
project(mGBA)
|
project(mGBA)
|
||||||
set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries")
|
set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries")
|
||||||
|
set(CMAKE_C_STANDARD 99)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
set(GCC_STD "c99")
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
if(SWITCH)
|
if(SWITCH)
|
||||||
set(GCC_STD "gnu11")
|
set(CMAKE_C_STANDARD 11)
|
||||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_COMPILER_VERSION VERSION_LESS "4.3")
|
set(CMAKE_C_EXTENSIONS ON)
|
||||||
set(GCC_STD "gnu99")
|
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.3")
|
||||||
|
set(CMAKE_C_EXTENSIONS ON)
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-missing-field-initializers -std=${GCC_STD}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-missing-field-initializers")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue