FluidSynth / fluidsynth

Software synthesizer based on the SoundFont 2 specifications
https://www.fluidsynth.org
GNU Lesser General Public License v2.1
1.76k stars 246 forks source link

Fix an import library is treated as a static library on OS/2 #1320

Closed komh closed 3 weeks ago

komh commented 2 months ago

Hi/2.

I've fixed CMake configuring failure on OS/2.

Here is the patch, review please...

0001-Fix-an-import-library-is-treated-as-a-static-library.patch

From 76f23ebb598a47bbec31401766ab17b9934815d7 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Tue, 23 Apr 2024 15:23:38 +0900
Subject: [PATCH] Fix an import library is treated as a static library on OS/2

On OS/2, a suffix of an import library is '_dll.a', and a suffix of
a static library is '.a'.

Because of this, an import library is treated as a static library in
get_target_properties_from_pkg_config().
---
 cmake_admin/PkgConfigHelpers.cmake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmake_admin/PkgConfigHelpers.cmake b/cmake_admin/PkgConfigHelpers.cmake
index 8c98fe3f..4a9f87f5 100644
--- a/cmake_admin/PkgConfigHelpers.cmake
+++ b/cmake_admin/PkgConfigHelpers.cmake
@@ -76,7 +76,8 @@ macro ( unset_pkg_config _prefix )
 endmacro ( unset_pkg_config )

 function ( get_target_properties_from_pkg_config _library _prefix _out_prefix )
-  if ( "${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$" )
+  if ( NOT "${_library}" MATCHES "${CMAKE_IMPORT_LIBRARY_SUFFIX}$"
+       AND "${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$" )
     set ( _cflags ${_prefix}_STATIC_CFLAGS_OTHER )
     set ( _link_libraries ${_prefix}_STATIC_LIBRARIES )
     set ( _library_dirs ${_prefix}_STATIC_LIBRARY_DIRS )
-- 
2.42.0
derselbst commented 2 months ago

Looks good, and CI is passing as well. Thanks/2 :)