diff options
author | 3gg <3gg@shellblade.net> | 2025-08-30 16:53:58 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-08-30 16:53:58 -0700 |
commit | 6aaedb813fa11ba0679c3051bc2eb28646b9506c (patch) | |
tree | 34acbfc9840e02cb4753e6306ea7ce978bf8b58e /src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake | |
parent | 8f228ade99dd3d4c8da9b78ade1815c9adf85c8f (diff) |
Update to SDL3
Diffstat (limited to 'src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake')
-rw-r--r-- | src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake b/src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake new file mode 100644 index 0000000..7070fac --- /dev/null +++ b/src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake | |||
@@ -0,0 +1,34 @@ | |||
1 | # Helper for Find modules | ||
2 | |||
3 | function(get_flags_from_pkg_config _library _pc_prefix _out_prefix) | ||
4 | if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") | ||
5 | set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER) | ||
6 | set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES) | ||
7 | set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER) | ||
8 | set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS) | ||
9 | else() | ||
10 | set(_cflags ${_pc_prefix}_CFLAGS_OTHER) | ||
11 | set(_link_libraries ${_pc_prefix}_LIBRARIES) | ||
12 | set(_link_options ${_pc_prefix}_LDFLAGS_OTHER) | ||
13 | set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS) | ||
14 | endif() | ||
15 | |||
16 | # The *_LIBRARIES lists always start with the library itself | ||
17 | list(POP_FRONT "${_link_libraries}") | ||
18 | |||
19 | # Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A` | ||
20 | string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}") | ||
21 | |||
22 | set(${_out_prefix}_compile_options | ||
23 | "${${_cflags}}" | ||
24 | PARENT_SCOPE) | ||
25 | set(${_out_prefix}_link_libraries | ||
26 | "${${_link_libraries}}" | ||
27 | PARENT_SCOPE) | ||
28 | set(${_out_prefix}_link_options | ||
29 | "${_filtered_link_options}" | ||
30 | PARENT_SCOPE) | ||
31 | set(${_out_prefix}_link_directories | ||
32 | "${${_library_dirs}}" | ||
33 | PARENT_SCOPE) | ||
34 | endfunction() | ||