mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-04 02:47:39 +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
39 lines
1.4 KiB
CMake
39 lines
1.4 KiB
CMake
# Helper for Find modules
|
|
|
|
function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
|
|
if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
|
|
set(_include_dirs ${_pc_prefix}_STATIC_INCLUDE_DIRS)
|
|
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
|
|
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
|
|
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
|
|
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
|
|
else()
|
|
set(_include_dirs ${_pc_prefix}_INCLUDE_DIRS)
|
|
set(_cflags ${_pc_prefix}_CFLAGS_OTHER)
|
|
set(_link_libraries ${_pc_prefix}_LIBRARIES)
|
|
set(_link_options ${_pc_prefix}_LDFLAGS_OTHER)
|
|
set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS)
|
|
endif()
|
|
|
|
# The *_LIBRARIES lists always start with the library itself
|
|
list(POP_FRONT "${_link_libraries}")
|
|
|
|
# Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A`
|
|
string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}")
|
|
|
|
set(${_out_prefix}_include_dirs
|
|
"${${_include_dirs}}"
|
|
PARENT_SCOPE)
|
|
set(${_out_prefix}_compile_options
|
|
"${${_cflags}}"
|
|
PARENT_SCOPE)
|
|
set(${_out_prefix}_link_libraries
|
|
"${${_link_libraries}}"
|
|
PARENT_SCOPE)
|
|
set(${_out_prefix}_link_options
|
|
"${_filtered_link_options}"
|
|
PARENT_SCOPE)
|
|
set(${_out_prefix}_link_directories
|
|
"${${_library_dirs}}"
|
|
PARENT_SCOPE)
|
|
endfunction()
|