From d3aff13aa3955fd64fdf8bccadc5cf9f597140d5 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 3 Oct 2025 20:58:45 +0200 Subject: [PATCH] cmake: use correct suffix in PkgConfigHelper (cherry picked from commit 0bbfbf5b3788b7a10968a108184291c5afe302be) --- cmake/PkgConfigHelper.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/PkgConfigHelper.cmake b/cmake/PkgConfigHelper.cmake index 7070fac795..44d74310f2 100644 --- a/cmake/PkgConfigHelper.cmake +++ b/cmake/PkgConfigHelper.cmake @@ -1,16 +1,21 @@ # Helper for Find modules function(get_flags_from_pkg_config _library _pc_prefix _out_prefix) - if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") - 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) + if(MINGW) + set(re_shared_suffix ".dll.a$") else() + set(re_shared_suffix "${CMAKE_SHARED_LIBRARY_SUFFIX}$") + endif() + if("${_library}" MATCHES "${re_shared_suffix}") 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) + else() + 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) endif() # The *_LIBRARIES lists always start with the library itself