all repos — mgba @ 691c202c402c3dac350f8b90e5ffd65d2932a0a9

mGBA Game Boy Advance Emulator

CMake: Fix C standard selection
Vicki Pfau vi@endrift.com
Tue, 26 May 2020 22:09:43 -0700
commit

691c202c402c3dac350f8b90e5ffd65d2932a0a9

parent

11ccbca4ffd33e82e5595ce0f959d4d17a6d0cb9

1 files changed, 8 insertions(+), 5 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -9,14 +9,17 @@ cmake_policy(SET CMP0072 NEW)

endif() project(mGBA) set(BINARY_NAME mgba CACHE INTERNAL "Name of output binaries") +set(CMAKE_C_STANDARD 99) if(NOT MSVC) - set(GCC_STD "c99") + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS OFF) if(SWITCH) - set(GCC_STD "gnu11") - elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_COMPILER_VERSION VERSION_LESS "4.3") - set(GCC_STD "gnu99") + set(CMAKE_C_STANDARD 11) + set(CMAKE_C_EXTENSIONS ON) + elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.3") + set(CMAKE_C_EXTENSIONS ON) 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() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /wd4003 /wd4244 /wd4146") endif()