From e78ebbcb19724491e9ad69ce9bf463161128678f Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 16 Nov 2022 07:57:44 +0100 Subject: Fall back to dynamic libraries in .la files This is what the linker does, so we should do the same for correct behaviour. --- cmake/Modules/CMakeMacroLibtoolFile.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake index 14951285..1115c0d3 100644 --- a/cmake/Modules/CMakeMacroLibtoolFile.cmake +++ b/cmake/Modules/CMakeMacroLibtoolFile.cmake @@ -89,15 +89,19 @@ macro(libtool_create_control_file _target) endif() if(STATIC_MODE) - set(library ${CMAKE_STATIC_LIBRARY_PREFIX}${library}${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(_library ${CMAKE_STATIC_LIBRARY_PREFIX}${library}${CMAKE_STATIC_LIBRARY_SUFFIX}) + find_library(FL ${_library} PATHS ${LIBRARY_PATHS}) + endif() + + if(NOT FL) + find_library(FL ${library} PATHS ${LIBRARY_PATHS}) endif() - find_library(FL ${library} PATHS ${LIBRARY_PATHS}) if(FL) # Found library. Depending on if it's static or not we might # extract the path and library name, then add the # result to the libtool dependency libs. - if(STATIC_MODE) + if("${FL}" MATCHES ".+${CMAKE_STATIC_LIBRARY_SUFFIX}$") set(_target_dependency_libs "${_target_dependency_libs} ${FL}") else() get_filename_component(_shared_lib ${FL} NAME_WE) -- cgit v1.2.3