cmake: don't reset check state after pushing state

This commit is contained in:
Anonymous Maarten 2022-11-24 22:38:13 +01:00
parent 67f31a19a8
commit cd13600944
4 changed files with 12 additions and 11 deletions

View File

@ -519,14 +519,15 @@ set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
if(SDL_WERROR)
if(MSVC)
cmake_push_check_state(RESET)
cmake_push_check_state()
check_c_compiler_flag(/WX HAVE_WX)
if(HAVE_WX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif()
cmake_pop_check_state()
elseif(USE_GCC OR USE_CLANG)
cmake_push_check_state(RESET)
cmake_push_check_state()
check_c_compiler_flag(-Werror HAVE_WERROR)
if(HAVE_WERROR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
@ -682,7 +683,7 @@ if(USE_GCC OR USE_CLANG)
endif()
if(APPLE)
cmake_push_check_state(RESET)
cmake_push_check_state()
# FIXME: don't use deprecated declarations
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
@ -705,7 +706,7 @@ if(USE_GCC OR USE_CLANG)
if(MINGW)
# See if GCC's -gdwarf-4 is supported
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows
cmake_push_check_state(RESET)
cmake_push_check_state()
check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4)
if(HAVE_GDWARF_4)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4")
@ -1195,7 +1196,7 @@ if(ANDROID)
# There seems to be no better way currently to set the ARM mode.
# see: https://issuetracker.google.com/issues/62264618
# Another option would be to set ARM mode to all compiled files
cmake_push_check_state(RESET)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument")
check_c_compiler_flag(-marm HAVE_ARM_MODE)
if(HAVE_ARM_MODE)
@ -2366,7 +2367,7 @@ elseif(RISCOS)
elseif(VITA)
# SDL_spinlock.c Needs to be compiled in ARM mode.
cmake_push_check_state(RESET)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "-Werror=unused-command-line-argument")
check_c_compiler_flag(-marm HAVE_ARM_MODE)
if(HAVE_ARM_MODE)

View File

@ -2,7 +2,7 @@ include(CheckCSourceCompiles)
include(CMakePushCheckState)
function(_internal_check_cpu_architecture macro_check NAME VARIABLE)
cmake_push_check_state(RESET)
cmake_push_check_state()
string(TOUPPER "${NAME}" UPPER_NAME)
set(CACHE_VARIABLE "CHECK_CPU_ARCHITECTURE_${UPPER_NAME}")
set(test_src "

View File

@ -33,7 +33,7 @@ macro(FindLibraryAndSONAME _LIB)
endmacro()
macro(CheckDLOPEN)
cmake_push_check_state(RESET)
cmake_push_check_state()
check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN_IN_LIBC)
if(NOT HAVE_DLOPEN_IN_LIBC)
set(CMAKE_REQUIRED_LIBRARIES dl)
@ -278,7 +278,7 @@ endmacro()
# - SDL_X11_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckX11)
cmake_push_check_state(RESET)
cmake_push_check_state()
if(SDL_X11)
foreach(_LIB X11 Xext Xcursor Xi Xfixes Xrandr Xrender Xss)
FindLibraryAndSONAME("${_LIB}")

View File

@ -148,7 +148,7 @@ if(APPLE)
testutils.c
)
cmake_push_check_state(RESET)
cmake_push_check_state()
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
cmake_pop_check_state()
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
@ -191,7 +191,7 @@ add_sdl_test_executable(controllermap NEEDS_RESOURCES controllermap.c testutils.
add_sdl_test_executable(testvulkan testvulkan.c)
add_sdl_test_executable(testoffscreen testoffscreen.c)
cmake_push_check_state(RESET)
cmake_push_check_state()
check_c_compiler_flag(-Wformat-overflow HAVE_WFORMAT_OVERFLOW)
if(HAVE_WFORMAT_OVERFLOW)