summaryrefslogtreecommitdiffstats
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2017-07-07 20:38:52 (GMT)
committerBrad King <brad.king@kitware.com>2017-07-10 15:16:51 (GMT)
commit3cf267cfbf740e8c8dc28f132fff5042c7201d3d (patch)
tree4aa405eedf5a7b0027758bb0fdd225c295680396 /Modules/FindPkgConfig.cmake
parent2ef3527dfe03ac6e5f5c49d13d99b2304381b0a8 (diff)
downloadCMake-3cf267cfbf740e8c8dc28f132fff5042c7201d3d.zip
CMake-3cf267cfbf740e8c8dc28f132fff5042c7201d3d.tar.gz
CMake-3cf267cfbf740e8c8dc28f132fff5042c7201d3d.tar.bz2
FindPkgConfig: do not always rerun pkg_check_modules() with 2 arguments
Since commit v3.8.0-rc1~47^2 (FindPkgConfig: Recheck pkg-config on parameter change, 2017-01-17) calling `pkg_check_modules` always re-runs. The problem is that if there are only 2 arguments passed to `pkg_check_modules```, then `_module0` will be set and `ARGN` will be empty. When this is written to cache it will be stored as just the value of `_module0` without any semicolon, so on the next run this doesn't match the expected value and the search is rerun. Revise the logic to handle the case of empty `ARGN` separately. Fixes: #17003
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index a5357fa..8ac1691 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -584,7 +584,9 @@ endmacro()
macro(pkg_check_modules _prefix _module0)
_pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
- if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND OR NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}")
+ if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND OR
+ (NOT "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0};${ARGN}") OR
+ ( "${ARGN}" STREQUAL "" AND NOT "${__pkg_config_arguments_${_prefix}}" STREQUAL "${_module0}"))
_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})