mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 15:14:56 +00:00 
			
		
		
		
	cmake: fix detection of library functions when -Werror is enabled.
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
This commit is contained in:
		
							parent
							
								
									ad0d1e2ad5
								
							
						
					
					
						commit
						305e7b55bd
					
				| 
						 | 
				
			
			@ -483,26 +483,6 @@ set_option(SDL_INSTALL_TESTS   "Install test-cases" OFF)
 | 
			
		|||
 | 
			
		||||
set(HAVE_STATIC_PIC "${SDL_STATIC_PIC}")
 | 
			
		||||
 | 
			
		||||
if(SDL_WERROR)
 | 
			
		||||
  if(MSVC)
 | 
			
		||||
    cmake_push_check_state(RESET)
 | 
			
		||||
    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()
 | 
			
		||||
  elseif(USE_GCC OR USE_CLANG)
 | 
			
		||||
    cmake_push_check_state(RESET)
 | 
			
		||||
    check_c_compiler_flag(-Werror HAVE_WERROR)
 | 
			
		||||
    if(HAVE_WERROR)
 | 
			
		||||
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
 | 
			
		||||
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
 | 
			
		||||
      set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
 | 
			
		||||
    endif()
 | 
			
		||||
    cmake_pop_check_state()
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(SDL_HIDAPI)
 | 
			
		||||
  if(HIDAPI_ONLY_LIBUSB)
 | 
			
		||||
    set(SDL_HIDAPI_LIBUSB ON CACHE BOOL "" FORCE)
 | 
			
		||||
| 
						 | 
				
			
			@ -2943,6 +2923,26 @@ if(NOT SDLMAIN_SOURCES)
 | 
			
		|||
  file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(SDL_WERROR)
 | 
			
		||||
  if(MSVC)
 | 
			
		||||
    cmake_push_check_state(RESET)
 | 
			
		||||
    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()
 | 
			
		||||
  elseif(USE_GCC OR USE_CLANG)
 | 
			
		||||
    cmake_push_check_state(RESET)
 | 
			
		||||
    check_c_compiler_flag(-Werror HAVE_WERROR)
 | 
			
		||||
    if(HAVE_WERROR)
 | 
			
		||||
      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
 | 
			
		||||
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
 | 
			
		||||
      set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
 | 
			
		||||
    endif()
 | 
			
		||||
    cmake_pop_check_state()
 | 
			
		||||
  endif()
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# Append the -MMD -MT flags
 | 
			
		||||
# if(DEPENDENCY_TRACKING)
 | 
			
		||||
#   if(COMPILER_IS_GNUCC)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue