summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake')
-rw-r--r--src/contrib/SDL-3.2.20/cmake/PkgConfigHelper.cmake34
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
3function(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)
34endfunction()