From cd13600944950cf1e11243e0cf013001a82ddcdf Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 24 Nov 2022 22:38:13 +0100 Subject: [PATCH] cmake: don't reset check state after pushing state --- CMakeLists.txt | 13 +++++++------ cmake/CheckCPUArchitecture.cmake | 2 +- cmake/sdlchecks.cmake | 4 ++-- test/CMakeLists.txt | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 443aa36ad..9a113b15b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/CheckCPUArchitecture.cmake b/cmake/CheckCPUArchitecture.cmake index 79639f1c2..ccf46f879 100644 --- a/cmake/CheckCPUArchitecture.cmake +++ b/cmake/CheckCPUArchitecture.cmake @@ -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 " diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index ececfa942..80c904f5a 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -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}") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8afa14f47..3eef835d2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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)