FindPkgConfig: set standard variables in the cache

Fixes a regression introduced when the code was simplified to use the
variable queries.

Fixes #15903.

Reported-by: Bernd Lörwald
This commit is contained in:
Ben Boeckel 2016-01-20 14:38:05 -05:00
parent d8bced813c
commit 40249bccdf
3 changed files with 20 additions and 0 deletions

View File

@ -382,6 +382,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix") pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR)
_pkgconfig_set("${_pkg_check_modules_pkg}_${variable}" "${${_pkg_check_modules_pkg}_${variable}}")
endforeach ()
if (NOT ${_is_silent}) if (NOT ${_is_silent})
message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")

View File

@ -0,0 +1,16 @@
find_package(PkgConfig REQUIRED)
pkg_check_modules(NCURSES QUIET ncurses)
if (NCURSES_FOUND)
foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR)
get_property("${variable}"
CACHE "NCURSES_${variable}"
PROPERTY TYPE
SET)
if (NOT ${variable})
message(FATAL_ERROR "Failed to set cache entry for NCURSES_${variable}")
endif ()
endforeach ()
else ()
message(STATUS "skipping test; ncurses not found")
endif ()

View File

@ -14,4 +14,5 @@ endif()
find_package(PkgConfig) find_package(PkgConfig)
if (PKG_CONFIG_FOUND) if (PKG_CONFIG_FOUND)
run_cmake(FindPkgConfig_GET_VARIABLE) run_cmake(FindPkgConfig_GET_VARIABLE)
run_cmake(FindPkgConfig_cache_variables)
endif () endif ()