diff options
author | Brad King <brad.king@kitware.com> | 2019-09-03 13:30:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-09-03 13:33:02 (GMT) |
commit | d8e323761152dcf494606ca3436637a9cbbe1741 (patch) | |
tree | fd3f61a377c87a89b5ad1067ff5ec60a76bf978f /Modules | |
parent | 2e6effd2e0d8e60ede4aa528e771430071c546b4 (diff) | |
parent | fe683876952ee6172e46fe770b4f3e48c69646d1 (diff) | |
download | CMake-d8e323761152dcf494606ca3436637a9cbbe1741.zip CMake-d8e323761152dcf494606ca3436637a9cbbe1741.tar.gz CMake-d8e323761152dcf494606ca3436637a9cbbe1741.tar.bz2 |
Merge topic 'FindPkgConfig-module-name'
fe68387695 FindPkgConfig: return the module found by pkg_search_module
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3749
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPkgConfig.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index e05d5c8..4c9af91 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -363,6 +363,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma _pkgconfig_unset(${_prefix}_PREFIX) _pkgconfig_unset(${_prefix}_INCLUDEDIR) _pkgconfig_unset(${_prefix}_LIBDIR) + _pkgconfig_unset(${_prefix}_MODULE_NAME) _pkgconfig_unset(${_prefix}_LIBS) _pkgconfig_unset(${_prefix}_LIBS_L) _pkgconfig_unset(${_prefix}_LIBS_PATHS) @@ -480,6 +481,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR) _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}") endforeach () + _pkgconfig_set("${_pkg_check_prefix}_MODULE_NAME" "${_pkg_check_modules_pkg}") if (NOT ${_is_silent}) message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") @@ -664,6 +666,10 @@ endmacro() [IMPORTED_TARGET [GLOBAL]] <moduleSpec> [<moduleSpec>...]) + If a module is found, the ``<prefix>_MODULE_NAME`` variable will contain the + name of the matching module. This variable can be used if you need to run + :command:`pkg_get_variable`. + Example: .. code-block:: cmake @@ -688,6 +694,7 @@ macro(pkg_search_module _prefix _module0) if (${_prefix}_FOUND) set(_pkg_modules_found 1) + break() endif() endforeach() |