summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-05-08 12:36:32 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-05-08 12:37:35 (GMT)
commite16a04ce2ec02e1ba97f117c7f1ddadfbe5909c9 (patch)
tree50811db8e8a217db4165b79d4797dff7bb7ec054
parentf60e2eb3c59f8c2a8a1f4f8013da8eeedc0c459d (diff)
parentac5731a7e380349f19dc319e6c31e189b5faba93 (diff)
downloadCMake-e16a04ce2ec02e1ba97f117c7f1ddadfbe5909c9.zip
CMake-e16a04ce2ec02e1ba97f117c7f1ddadfbe5909c9.tar.gz
CMake-e16a04ce2ec02e1ba97f117c7f1ddadfbe5909c9.tar.bz2
Merge topic 'pkgconf-imp-target-lib-path'
ac5731a7e3 FindPkgConfig: correct library search path for imported targets. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2027
-rw-r--r--Modules/FindPkgConfig.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 415e914..95af0bf 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -200,9 +200,7 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat
unset(_search_paths)
foreach (flag IN LISTS ${_prefix}_LDFLAGS)
if (flag MATCHES "^-L(.*)")
- # only look into the given paths from now on
list(APPEND _search_paths ${CMAKE_MATCH_1})
- set(_find_opts HINTS ${_search_paths} NO_DEFAULT_PATH)
continue()
endif()
if (flag MATCHES "^-l(.*)")
@@ -211,6 +209,12 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat
continue()
endif()
+ if(_search_paths)
+ # Firstly search in -L paths
+ find_library(pkgcfg_lib_${_prefix}_${_pkg_search}
+ NAMES ${_pkg_search}
+ HINTS ${_search_paths} NO_DEFAULT_PATH)
+ endif()
find_library(pkgcfg_lib_${_prefix}_${_pkg_search}
NAMES ${_pkg_search}
${_find_opts})