From: Pierre Ossman Date: Wed, 16 Nov 2022 06:56:41 +0000 (+0100) Subject: Respect library search paths X-Git-Tag: v1.13.90~96^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=651e7633381453e7a33052b23b1a85b6d81b4449;p=tigervnc.git Respect library search paths Things might be in odd places, so make sure we respect where we're told to look for libraries. --- diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake index 88ff335a..14951285 100644 --- a/cmake/Modules/CMakeMacroLibtoolFile.cmake +++ b/cmake/Modules/CMakeMacroLibtoolFile.cmake @@ -29,6 +29,8 @@ macro(libtool_create_control_file _target) set(STATIC_MODE OFF) set(FRAMEWORK OFF) + get_property(LIBRARY_PATHS TARGET ${_target} + PROPERTY INTERFACE_LINK_DIRECTORIES) foreach(library ${target_libs}) if(FRAMEWORK) @@ -73,6 +75,10 @@ macro(libtool_create_control_file _target) elseif(${library} STREQUAL "-Wl,-Bdynamic") # All following libraries should be dynamic set(STATIC_MODE OFF) + elseif(${library} MATCHES "^${CMAKE_LIBRARY_PATH_FLAG}") + # Library search path + string(REPLACE ${CMAKE_LIBRARY_PATH_FLAG} "" library ${library}) + list(APPEND LIBRARY_PATHS ${library}) else() # Normal library, so use find_library() to attempt to locate the # library in a system directory. @@ -86,7 +92,7 @@ macro(libtool_create_control_file _target) set(library ${CMAKE_STATIC_LIBRARY_PREFIX}${library}${CMAKE_STATIC_LIBRARY_SUFFIX}) endif() - find_library(FL ${library}) + 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