mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 09:44:35 +00:00 
			
		
		
		
	main features:
- No more sdl-build-options/sdl-shared-build-options/sdl-global-options
- Dependency information is stored on SDL3-collector for sdl3.pc
- Use helper functions to modify the SDL targets;
    - sdl_sources to add sources
    - sdl_glob_sources to add glob soruces
    - sdl_link_dependency to add a link dependency that might also
      appear in sdl3.pc/SDL3Config.cmake
    - sdl_compile_definitions to add macro's
    - sdl_compile_options for compile options
    - sdl_include_directories for include directories
  They avoid repeated checks for existence of the SDL targets
- A nice feature of the previous is the ability to generate
  a sdl3.pc or SDL3Config.cmake that describes its dependencies
  accurately.
various:
- remove duplicate libc symbol list
- add CheckVulkan
- remove unused HAVE_MPROTECT
- add checks for getpagesize
		
	
		
			
				
	
	
		
			98 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
# SDL cmake project-config input for CMakeLists.txt script
 | 
						|
 | 
						|
include(FeatureSummary)
 | 
						|
set_package_properties(SDL3 PROPERTIES
 | 
						|
  URL "https://www.libsdl.org/"
 | 
						|
  DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
 | 
						|
)
 | 
						|
 | 
						|
@PACKAGE_INIT@
 | 
						|
 | 
						|
set(SDL3_FOUND TRUE)
 | 
						|
set(_sdl3_framework @SDL_FRAMEWORK@)
 | 
						|
 | 
						|
# Find SDL3::Headers
 | 
						|
if(NOT TARGET SDL3::Headers)
 | 
						|
  include("${CMAKE_CURRENT_LIST_DIR}/SDL3headersTargets.cmake")
 | 
						|
endif()
 | 
						|
set(SDL3_Headers_FOUND TRUE)
 | 
						|
 | 
						|
# Find SDL3::SDL3-shared
 | 
						|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3sharedTargets.cmake")
 | 
						|
  include("${CMAKE_CURRENT_LIST_DIR}/SDL3sharedTargets.cmake")
 | 
						|
  set(SDL3_SDL3-shared_FOUND TRUE)
 | 
						|
endif()
 | 
						|
 | 
						|
macro(find_sdl3_static_dependencies)
 | 
						|
@SDL_FIND_PKG_CONFIG_COMMANDS@
 | 
						|
endmacro()
 | 
						|
 | 
						|
# Find SDL3::SDL3-static
 | 
						|
if(_sdl3_framework)
 | 
						|
  set(SDL3_SDL3-static_FOUND TRUE)
 | 
						|
  find_sdl3_static_dependencies()
 | 
						|
  find_package(SDL3-static CONFIG)
 | 
						|
  if(SDL3_SDL3-static_FOUND AND SDL3-static_FOUND)
 | 
						|
    set(SDL3_SDL3-static_FOUND TRUE)
 | 
						|
  endif()
 | 
						|
else()
 | 
						|
  if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
 | 
						|
    set(SDL3_SDL3-static_FOUND TRUE)
 | 
						|
    find_sdl3_static_dependencies()
 | 
						|
    if(SDL3_SDL3-static_FOUND)
 | 
						|
      if(ANDROID OR HAIKU)
 | 
						|
        enable_language(CXX)
 | 
						|
      endif()
 | 
						|
      include("${CMAKE_CURRENT_LIST_DIR}/SDL3staticTargets.cmake")
 | 
						|
    endif()
 | 
						|
  endif()
 | 
						|
endif()
 | 
						|
 | 
						|
if(SDL3_SDL3-shared_FOUND OR SDL3_SDL3-static_FOUND)
 | 
						|
  set(SDL3_SDL3_FOUND TRUE)
 | 
						|
endif()
 | 
						|
 | 
						|
# Find SDL3::SDL3_test
 | 
						|
if(_sdl3_framework)
 | 
						|
  find_package(SDL3_test CONFIG)
 | 
						|
  if(SDL3_test_FOUND)
 | 
						|
    enable_language(OBJC)
 | 
						|
    set(SDL3_SDL3_test_FOUND TRUE)
 | 
						|
  endif()
 | 
						|
else()
 | 
						|
  if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
 | 
						|
    set(SDL3_SDL3_test_FOUND TRUE)
 | 
						|
@SDL_TEST_FIND_PKG_CONFIG_COMMANDS@
 | 
						|
    if(SDL3_SDL3_test_FOUND)
 | 
						|
      include("${CMAKE_CURRENT_LIST_DIR}/SDL3testTargets.cmake")
 | 
						|
    endif()
 | 
						|
  endif()
 | 
						|
endif()
 | 
						|
 | 
						|
check_required_components(SDL3)
 | 
						|
 | 
						|
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
 | 
						|
  if(CMAKE_VERSION VERSION_LESS "3.18")
 | 
						|
    # Aliasing local targets is not supported on CMake < 3.18, so make it global.
 | 
						|
    add_library(${NEW_TARGET} INTERFACE IMPORTED)
 | 
						|
    set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
 | 
						|
  else()
 | 
						|
    add_library(${NEW_TARGET} ALIAS ${TARGET})
 | 
						|
  endif()
 | 
						|
endfunction()
 | 
						|
 | 
						|
# Make sure SDL3::SDL3 always exists
 | 
						|
if(NOT TARGET SDL3::SDL3)
 | 
						|
  if(TARGET SDL3::SDL3-shared)
 | 
						|
    _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-shared)
 | 
						|
  else()
 | 
						|
    _sdl_create_target_alias_compat(SDL3::SDL3 SDL3::SDL3-static)
 | 
						|
  endif()
 | 
						|
endif()
 | 
						|
 | 
						|
set(SDL3_LIBRARIES SDL3::SDL3)
 | 
						|
set(SDL3_STATIC_LIBRARIES SDL3::SDL3-static)
 | 
						|
set(SDL3_STATIC_PRIVATE_LIBS)
 | 
						|
 | 
						|
set(SDL3TEST_LIBRARY SDL3::SDL3_test)
 |