]> source.dussan.org Git - tigervnc.git/commitdiff
Respect library search paths
authorPierre Ossman <ossman@cendio.se>
Wed, 16 Nov 2022 06:56:41 +0000 (07:56 +0100)
committerPierre Ossman <ossman@cendio.se>
Tue, 10 Jan 2023 18:41:13 +0000 (19:41 +0100)
Things might be in odd places, so make sure we respect where we're told
to look for libraries.

cmake/Modules/CMakeMacroLibtoolFile.cmake

index 88ff335aa03e16bc9b62e2f37ae43269a7512c55..14951285b3e3e2e76bf0ea79cd3ebcc8524bb62c 100644 (file)
@@ -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